Opened 5 months ago

Closed 5 months ago

#2161 closed defect (fixed)

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 (1)

comment:1 Changed 5 months ago by riza

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

In 5909:

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

Note: See TracTickets for help on using tickets.