Opened 11 years ago
Closed 11 years ago
#1737 closed defect (fixed)
Deadlock between ioqueue key mutex and SIP dialog when adding video media with ICE and STUN enabled
Reported by: | bennylp | Owned by: | bennylp |
---|---|---|---|
Priority: | normal | Milestone: | release-2.2 |
Component: | pjsua-lib | Version: | trunk |
Keywords: | Cc: | ||
Backport to 1.x milestone: | Backported: | no |
Description
This happens because create_ice_media_transport() calls handle_events() while holding dialog mutex, thus will cause deadlock if a worker thread is receiving a message and wants to acquire the dialog mutex.
Sample scenario:
- Thread 1: add video, create ice transport, holding dialog mutex, polling for events, got data, acquiring ioqueue key mutex
- Thread 8: incoming request, holding ioqueue key mutex, acquiring dialog, fail and retry forever
Thread [1] (Suspended: Signal 'SIGINT' received. Description: Interrupt.) 18 __lll_lock_wait() 17 _L_lock_903() 16 pthread_mutex_lock() 15 pj_mutex_lock() ~/pjlib/src/pj/os_core_unix.c:1243 14 pj_lock_acquire() ~/pjlib/src/pj/lock.c:180 13 pj_ioqueue_lock_key() ~/pjlib/src/pj/ioqueue_common_abs.c:1324 12 ioqueue_dispatch_read_event() ~/pjlib/src/pj/ioqueue_common_abs.c:428 11 pj_ioqueue_poll() ~/pjlib/src/pj/ioqueue_select.c:963 10 pjsip_endpt_handle_events2() ~/pjsip/src/pjsip/sip_endpoint.c:741 9 pjsua_handle_events() ~/pjsip/src/pjsua-lib/pjsua_core.c:1833 8 create_ice_media_transport() ~/pjsip/src/pjsua-lib/pjsua_media.c:836 7 pjsua_call_media_init() ~/pjsip/src/pjsua-lib/pjsua_media.c:1336 6 call_add_video() ~/pjsip/src/pjsua-lib/pjsua_vid.c:1555 5 pjsua_call_set_vid_strm() ~/pjsip/src/pjsua-lib/pjsua_vid.c:2087 4 vid_handle_menu() 3 legacy_main() 2 pjsua_app_run() 1 main() Thread [8] (Suspended) 18 nanosleep() 17 usleep() 16 pj_thread_sleep() ~/pjlib/src/pj/os_core_unix.c:760 15 mod_ua_on_rx_request() ~/pjsip/src/pjsip/sip_ua_layer.c:685 14 pjsip_endpt_process_rx_data() ~/pjsip/src/pjsip/sip_endpoint.c:886 13 endpt_on_rx_msg() ~/pjsip/src/pjsip/sip_endpoint.c:1036 12 pjsip_tpmgr_receive_packet() ~/pjsip/src/pjsip/sip_transport.c:1764 11 on_data_read() ~/pjsip/src/pjsip/sip_transport_tcp.c:1300 10 ioqueue_on_read_complete() ~/pjlib/src/pj/activesock.c:490 9 ioqueue_dispatch_read_event() ~/pjlib/src/pj/ioqueue_common_abs.c:591 8 pj_ioqueue_poll() ~/pjlib/src/pj/ioqueue_select.c:963 7 pjsip_endpt_handle_events2() ~/pjsip/src/pjsip/sip_endpoint.c:741 6 pjsua_handle_events() ~/pjsip/src/pjsua-lib/pjsua_core.c:1833 5 worker_thread() ~/pjsip/src/pjsua-lib/pjsua_core.c:694 4 thread_main() ~/pjlib/src/pj/os_core_unix.c:523 3 start_thread() 2 clone() 1 <symbol is not available>
Change History (1)
comment:1 Changed 11 years ago by bennylp
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
In 4749: