Ticket #2161 (closed defect: fixed)

Opened 3 weeks ago

Last modified 3 weeks ago

Avoid deadlock triggered by incoming message when transport is being shutdown

Reported by: riza Owned by: bennylp
Priority: normal Milestone: release-2.9
Component: pjsip Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

It is reported that a deadlock might occur when handling IP change / pjsua_handle_ip_change() is called.

Scenario:

  1. [MainThread] Transport is being shutdown e.g: by pjsua_handle_ip_change() -> pjsip_transport_shutdown()
    • at the start it will lock the transport (tp->lock)
  2. [pjsua_0] Incoming new INVITE message
    • lock pjsua on pjsua_call_on_incoming()
    • try to lock transport on tsx_update_transport() -> pjsip_transport_add_state_listener()
  3. [MainThread]
    • try to lock pjsua_acc_on_tp_state_changed() >> deadlock

Change History

comment:1 Changed 3 weeks ago by riza

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

In 5909:

Close #2161: Avoid deadlock triggered by incoming message when transport is being shutdown.

Note: See TracTickets for help on using tickets.