Ticket #1578 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Possible deadlock when call is adding new media with ICE and STUN enabled

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.1
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

Deadlock may happen if call is adding new media (e.g. adding video) with ICE enabled and more than one worker threads are used. The flow is below:

  1. Call is established with audio only.
  2. Re-INVITE with video is received, on_call_rx_offer() is called, which eventually calls create_ice_media_transport() which works synchronously. The dialog mutex is held by current thread at this point. The current thread then runs pjsua_handle_events() in a loop.
  3. on_ice_complete() is called called with PJ_ICE_STRANS_OP_INIT, which posts the job as timer event.
  4. another thread picks up the timer event, med_tp_timer_cb() is called, which calls acquire_call() and got stuck when acquiring dialog mutex which is being held by the polling thread above.

Thanks Itay Bianco for the report!

Change History

comment:1 Changed 6 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to fixed

In 4242:

Fixed #1578: Possible deadlock when call is adding new media with ICE and STUN enabled:
svn commit pjsip/src/pjsua-lib/pjsua_media.c -m Fixed

Note: See TracTickets for help on using tickets.