Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#1482 closed defect (fixed)

iPhone: Solution for application getting killed by iOS 5 due to too many wakeups

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-1.14
Component: applications Version: common
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by ming)

As has been reported in http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2011-November/013692.html, iOS 5 will kill an application if it wakes up more than 15 times in 300 seconds. Below is a typical stack trace for the "crash" event:

Exception Type:  00000020
Exception Codes: 0xbad22222
Highlighted Thread:  1

Application Specific Information:
SBUnsuspendLimit myapp[346] exceeded 15 wakes in 300 sec

There are several other discussions on the Apple's developer forum:

This ticket provides several tips that may help avoiding the situation.

  1. Use a background task to ensure that the app doesn't suspend immediately after being waken up. App most likely will need to send something when it is waken up, for example some requests or TCP keep-alive data. Chances are these data will be responded by the server. If the app immediately gets suspended after sending them, it will be waken up again when the response arrives, hence adding to the wake up count. The app should delay as much as iOS allows before it goes to suspended state again, to take care the fact that some requests do take a while to complete, for example due to authentication.
  1. Fixing spurious wakeups problem. It has been reported that iOS may wake up the application every 10 seconds even when there is no activity in the network. This has been correlated to TCP transport disconnection, i.e. once the TCP transport is disconnected the app starts to get waken up every 10 seconds even when Wireshark shows no activity at all. This issue seemed to have been fixed by #1465 and #1481, which now immediately close (or to close sooner) the TCP socket when it gets disconnected. If the app also holds a reference to the TCP transport, it should also release this reference once it gets the TCP disconnection notification (on the on_transport_state() callback), because the transport will only be destroyed once it's reference goes to zero.

Change History (6)

comment:1 Changed 13 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 13 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from Info: Solution for application is getting killed by iOS 5 due to too many wakeups to Info: Solution for application getting killed by iOS 5 due to too many wakeups

comment:3 Changed 13 years ago by bennylp

  • Backported unset
  • Description modified (diff)

comment:4 Changed 13 years ago by ming

  • Description modified (diff)

comment:5 Changed 10 years ago by nanang

  • Summary changed from Info: Solution for application getting killed by iOS 5 due to too many wakeups to iPhone: Solution for application getting killed by iOS 5 due to too many wakeups

comment:6 Changed 10 years ago by nanang

  • Type changed from enhancement to defect
Note: See TracTickets for help on using tickets.