Opened 6 years ago

Closed 6 years ago

#1714 closed defect (fixed)

Workaround for stuck in TCP/TLS shutdown when another thread is destroying the transport

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

Description

According to this report:


There seems to be a deadlock between destroy_transport() in sip_transport.c and tcp_init_shutdown() in sip_transport_tcp.c. In destroy_transport() the mutex tp->lock is acquired but not released until it’s destroyed in tp->destroy(tp)

On the other hand tcp_init_shutdown() is calling to pjsip_transport_shutdown() which acquires that same mutex which will never get released.

Maybe tcp_init_shutdown() shouldn’t do anything if the transport is already being destroyed?




The proper solution for this problem is to replace the locking mechanism in the SIP transport with group lock. For now, we just implemented the workaround by checking if destroy is currently in progress as suggested above.

Change History (1)

comment:1 Changed 6 years ago by bennylp

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

In 4661:

Fixed #1714: Workaround for stuck in TCP/TLS shutdown when another thread is destroying the transport

Note: See TracTickets for help on using tickets.