Opened 9 years ago

Closed 9 years ago

#1898 closed defect (fixed)

Transport may never gets destroyed when connected event comes while transport is shutting down

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

Description

Changeset r5000 tries to avoid transport-state "Connected" event getting propagated to application after the transport is shutdown. However it introduces a bug that may prevent the transport from getting destroyed because reference counter may never reaches zero.

Sample scenario in function stateless_send_transport_cb() in sip_util.c:

  1. pjsip_endpt_acquire_transport2() is invoked which creates a new TCP/TLS transport client. Note that this function also adds reference counter, and starts try to connect to remote.
  2. pjsip_transport_send() is invoked with callback set to itself (i.e: send_response_transport_cb()).
  3. Application (not sip_util.c) invokes pjsip_transport_shutdown() to this transport, e.g: because of IP change on iOS to close the TCP socket immediately (to avoid spurious wakeups, see #1482).
  4. Connected event comes from the ioqueue, TCP/TLS transport see that transport is being shutdown, so it simply returns (see r5000) without notifying application about the sending status.
  5. stateless_send_transport_cb() never gets notification of the sending status, so the transport reference counter never reaches zero.

Change History (1)

comment:1 Changed 9 years ago by nanang

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

In 5200:

Fix #1898: If transport is being shutdown/destroyed and connected event comes, proceed as error/cancelled connect.

Note: See TracTickets for help on using tickets.