Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1893 closed defect (fixed)

iOS application getting killed after pjsua fail to release a disconnected transport

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

Description (last modified by ming)

This is related to #1482 point 2 (spurious wakeups problem after TCP disconnection).

Scenario:

  1. Registration for account A is in progress, and DNS is in the process of resolving the hostname, hence TCP transport is not created yet and account transport (pjsua_acc.auto_rereg.reg_tp) is set to NULL.
  2. Transport eventually gets created, but account transport is not updated.
  3. Transport disconnection occurs, normally pjsua will release the disconnected transport from the account, however as transport pointer of account A is NULL, pjsua fails to detect and release it immediately.
    • Note that the transport stays not released/destroyed until a new registration by account A (using a new transport) is issued or the account is deleted.

Log:

14:14:35.020    pjsua_acc.c  .Acc 2: setting registration..
14:14:35.022     resolver.c  ...Transmitting 41 bytes to NS 0 (8.8.8.8:53): DNS SRV query for _sip._tcp.sip.pjsip.org: Success
14:14:35.022    pjsua_acc.c  ..Setting acc 2 reg_tp to NULL
14:14:35.022    pjsua_acc.c  ..Acc 2: Registration sent
...
14:14:35.102 tcpc0x1694de14  TCP client transport created
14:14:35.103 tcpc0x1694de14  TCP transport 192.168.1.2:51801 is connecting to 208.109.222.137:5060...

Which will cause this to happen:

10:51:40.669     ioq_select  Attempting to replace UDP socket 4
10:51:40.671     ioq_select  UDP has been replaced successfully!
10:51:40.671     resolver.c  DNS resolver read error from 8.8.8.8:53: Socket is not connected
10:51:40.671 tcpc0x15b99614  TCP connection closed
10:51:40.672    pjsua_app.c  SIP TCP transport is disconnected from [208.109.222.137:5060]: End of file (PJ_EEOF) [status=70016]
10:51:40.672    pjsua_acc.c  Disconnected notification for transport tcpc0x15b99614
10:51:50.694     ioq_select  Attempting to replace UDP socket 4
10:51:50.694     ioq_select  UDP has been replaced successfully!
10:51:50.694     resolver.c  DNS resolver read error from 8.8.8.8:53: Socket is not connected
...
10:52:00.707     ioq_select  Attempting to replace UDP socket 4
10:52:00.708     ioq_select  UDP has been replaced successfully!
10:52:00.708     resolver.c  DNS resolver read error from 8.8.8.8:53: Socket is not connected

[it will go on, and on, ....., and eventually, it will crash below]

10:54:00.840     ioq_select  UDP has been replaced successfully!
10:54:10.843     ioq_select  Attempting to replace UDP socket 4
10:54:10.845     ioq_select  UDP has been replaced successfully!
10:54:10.845     resolver.c  DNS resolver read error from 8.8.8.8:53: Socket is not connected
10:54:10.845     ioq_select  Attempting to replace UDP socket 7
10:54:10.845     ioq_select  UDP has been replaced successfully!
(lldb)

If the transport is released correctly, what you should be seeing in the log is:

12:58:14.836 tcpc0x153b4214  TCP connection closed
12:58:14.836    pjsua_app.c  SIP TCP transport is disconnected from [208.109.222.137:5060]: End of file (PJ_EEOF) [status=70016]
12:58:14.836    pjsua_acc.c  Disconnected notification for transport tcpc0x153b4214
12:58:14.847 tcpc0x153b4214  TCP transport destroyed with reason 70016: End of file (PJ_EEOF)

Notice the log saying that the TCP transport has been destroyed. If such message is missing from the log, the first step is to check whether app is still holding a reference to the particular transport.

Change History (2)

comment:1 Changed 9 years ago by ming

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

The fix is in r5188, which was accidentally checked into ticket #1873, which belonged to release 2.4.5.

comment:2 Changed 9 years ago by ming

  • Description modified (diff)
Note: See TracTickets for help on using tickets.