Deadlock issue (pjsip 2.1 @4701)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

 

We have our soft-phone application which uses PJSIP (2.1 @ rev 4701). The
following deadlock was noticed while running. I do not have the complete
stack trace but have a reasonable picture of the stack.

 

Stack thread 1 (app dials a call):

 

pj_mutex_lock(mod_ua.mutex) - blocks on this

pjsip_ua_register_dlg()

pjsip_dlg_create_uac()

pjsua_call_make_call() - acquires PJSUA_LOCK()

 

 

Stack thread 2 (an incoming call is answered by the app)

 

pjsua_call_on_state_changed() - blocks on  PJSUA_LOCK (acquired by thread 1)

inv_set_state()

inv_on_state_incoming()

mod_inv_on_tsx_state()

pjsip_dlg_on_tsx_state()

mod_ua_on_tsx_state()

tsx_set_state()

tsx_on_state_proceeding_uas()

pjsip_tsx_send_msg() -  acquires tsx->grp_lock

pjsip_dlg_send_response()

pjsip_inv_send_msg()

pjsua_call_answer2()

 

 

Stack thread 3 (incoming message on same tsx as in thread 2)

 

pj_grp_lock_acquire() - blocks on tsx->grp_lock

pjsip_tsx_layer_find_tsx()

find_dlg_set_for_msg()

mod_ua_on_request() - acquires mod_ua.mutex (on which thread 1 is blocked)

pjsip_endpt_process_rx_data()

endpt_on_rx_msg()

pjsip_tpmgr_received_packet()

udp_on_read_complete()

 

 

Seems like a typical dining philosopher's problem. Has this been
seen/reported earlier?

For me, a simple solution seems to be to do a try lock on (mod_ua.mutex)
when been acquired by the UAC (do not want to miss notifications from
network/UAS) and report failure back to application in case it fails.

 

Any suggestions?

 

Thanks,

Anshuman

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140523/3fbd74d1/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux