iOS5 background - waking 15 times in 300 seconds kicking the app

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My guess is this has come about because of the behaviour of certain voip
apps to cheat with UDP sockets..

I believe your app has 30 seconds to process stuff once it is sent to the
background, so if you are using a UDP voip system you could have a simple
TCP ?pinger? socket.. Basically it could ping you each 20 seconds so you
wake up, then you go back to sleep but your 30 second ?run while heading
back to sleep? would reactivate..

300 seconds / 20 = 15... The magic number they?re using now..

I agree with the ?having this crash when not receiving any calls?. I?m not
receiving any and I know our server isn?t sending much (nothing showing up
on our console logger out of the ordainary)..

And yes, it does seem more prevalent when you are disconnected.. My long
running test was fine for 18+ hrs, I disconnected to use the laptop
elsewhere and a couple of hours later it had faulted.

The next step is to have a wireshark running with the iPhone going via a
wifi device that I can sniff (macbook wifi->ethernet bridge)... I want a
complete history of the traffic hitting the iPhone so I can correlate the
behaviour.

I was thinking the same about counting the wakes but I?m also having trouble
identifying the state.. Is there anyway to know that the socket has just
woken up...? But it start?s getting a bit ridiculous then disconnecting from
the server quickly.. <shudder>.... They?ve really put bit of a bullet into
VoIP here..

My crash always points to a thread which is:

Thread 11 name:  com.apple.NSURLConnectionLoader
Thread 11:
0   libsystem_kernel.dylib            0x32246010 mach_msg_trap + 20
1   libsystem_kernel.dylib            0x32246206 mach_msg + 50
2   CoreFoundation                    0x30f4541c __CFRunLoopServiceMachPort
+ 120
3   CoreFoundation                    0x30f44154 __CFRunLoopRun + 876
4   CoreFoundation                    0x30ec74d6 CFRunLoopRunSpecific + 294
5   CoreFoundation                    0x30ec739e CFRunLoopRunInMode + 98
6   Foundation                        0x37f83bc2 +[NSURLConnection(Loader)
_resourceLoadLoop:] + 302
7   Foundation                        0x37f83a8a -[NSThread main] + 66
8   Foundation                        0x3801759a __NSThread__main__ + 1042
9   libsystem_c.dylib                 0x3670ec16 _pthread_start + 314
10  libsystem_c.dylib                 0x3670ead0 thread_start + 0

But I?ve even ran a build where anything remotely related to remote URL?s is
not in place and same thing... So not really sure it?s related..

Chris


On 13/11/2011 22:04, "s.marek at avm.de" <s.marek at avm.de> wrote:

> Hey Guys, 
> 
> you're not alone. ;)
> 
> I've opened up a thread in the official Apple forums months ago. Despite the
> complaints of other app-developers, unfortunately no really helpful input from
> Apple engineers so far. They helped to understand the situation, but they
> didn't provide a reasonable workaround to omit the crashes. :(
> 
> From what I figured out, it seems the app is changing from "running" to
> "suspended" after around 10 seconds. It was "easy" to reproduce the crash by
> calling the app from outside, letting it ring for a bit more than 10 seconds
> and hanging up on the calling end. This way you have the INVITE as the first
> and CANCEL as the second event, that triggers a running-state change in your
> app. After 8 calls you get the crash. On the other hand it is not that
> spectacular, because with this test, you just did what the exception says:
> you've woken up the app more then 15 times in under 5 minutes.
> 
> The strange thing is: I am pretty sure to have had these crashes in
> situations, where I did definitely not receive that many messages. So maybe
> Apple still has a counting bug in that new watchdog? These guys are human
> beings too. ;) 
> 
> We haven't found a proper solution yet. We thought of counting the "wakes"
> ourselfs and then disconnecting from the SIP server, when the critical count
> is reached, but there is no save way to tell, when you changed state.
> 
> A problem shared is a problem halved, ;)
> Sebastian. 
> 
> 
> pjsip-bounces at lists.pjsip.org schrieb am 13.11.2011 18:03:14:
> 
>> > Von: "Olle Frimanson" <olle.frimanson at keystream.se>
>> > An: "'pjsip list'" <pjsip at lists.pjsip.org>
>> > Datum: 13.11.2011 18:04
>> > Betreff: Re: [pjsip] iOS5 background - waking 15 times in 300
>> > seconds kicking the app
>> > Gesendet von: pjsip-bounces at lists.pjsip.org
>> > 
>> > Hi Chris, 
>> >  
>> > Ok for us it?s easier to detect, the present settings we have on the
>> > Asterisk is rather ?talky? so I get the crash every 30 min our so,
>> > but the we have NOTIFY and other messages that comes.
>> >  
>> > It seems like the app is restarted by iOS in background mode but
>> > that have given us some problems with crashed sockets.
>> >  
>> > I couldn?t agree more then this is a real pain.
>> >  
>> > BR/Olle 
>> >  
>> > 
>> > From: pjsip-bounces@xxxxxxxxxxxxxxx [mailto:pjsip-bounces at lists.pjsip.org
>> <mailto:pjsip-bounces at lists.pjsip.org> ]
>> > On Behalf Of Chris Moore
>> > Sent: den 13 november 2011 17:50
>> > To: pjsip list
>> > Subject: Re: iOS5 background - waking 15 times in 300
>> > seconds kicking the app
>> >  
>> > Hi Olle,
>> > 
>> > At the moment I?ve noticed this plugged in or not.
>> > 
>> > The code I?m playing with is in our application which detects
>> > network changes and re-initiates a registration and other stuff...
>> > So far removing this application logic is helping solve the problem
>> > but the test case run takes a long time (it took 12 hrs at first to
>> > crash, then so far I?ve run 18 hrs but that?s not a guarantee)..
>> > 
>> > IOS reducing it to 15 wakeups in 5 minutes is quite aggressive.. I?m
>> > unsure how long the wakeup ?allow to run? period is..
>> > 
>> > ie: if I get woken up, then determine I need to re-reg that?s run on
>> > a separate thread which selects while waiting for response from
>> > server.. So is the response then another wakeup?
>> > 
>> > Info on the iOS behaviour is tricky to find.. I only saw what Mark
>> > mentionedi n the beta iOS5. b5 change notes..
>> > 
>> > I was going to count the times I return fmor the socket select and
>> > I?m in background and try and count then... Them cross reference
>> > that with a permanent wireshark against the phone so I could see/
>> > analyse the traffic that suddenly puts it over the edge..
>> > 
>> > Its quite a pain..
>> > 
>> > Chris
>> > 
>> > 
>> > On 13/11/2011 16:31, "Olle Frimanson" <olle.frimanson at keystream.se> wrote:
>> > Hi Chris and Mark,
>> >  
>> > If you find a good solution on this pls let us all know. We are also
>> > struggling with the same problem and we have an Asterisk behind SIP proxy.
>> >  
>> > My observations so far is that this function don?t kick in if the
>> > phone is on power supply / USB. But it?s also not complete clear
>> > what actually counts as an event and is e.g. an incoming NOTIFY and
>> > corresponding reply 1 or 2 events.
>> >  
>> > If we find something will let you know.
>> >  
>> > BR/Olle
>> >  
>> > 
>> > From: pjsip-bounces@xxxxxxxxxxxxxxx [mailto:pjsip-bounces at lists.pjsip.org
>> <mailto:pjsip-bounces at lists.pjsip.org> ]
>> > On Behalf Of Chris Moore
>> > Sent: den 13 november 2011 17:26
>> > To: pjsip list
>> > Subject: Re: iOS5 background - waking 15 times in 300
>> > seconds kicking the app
>> > 
>> > Hi Mark,
>> > 
>> > Yeah, looks like a few apps are having this problem (ooVoo and
>> > Linphone are others out there with it).
>> > 
>> > I think I?ve found a little bit of the activity that was pushing it
>> > over the edge.. Will investigate further!
>> > 
>> > 
>> > 
>> > 
>> > On 13/11/2011 07:51, "Mark Kaplan" <mkaplan at interwise.com> wrote:
>> > Hi Chris, 
>> >  
>> > http://www.bgr.com/2011/07/22/apples-full-change-log-for-ios-5-beta-4/
>> <http://www.bgr.com/2011/07/22/apples-full-change-log-for-ios-5-beta-4/>
>> > : ?iOS 5.0 terminates VoIP applications that are resumed in the
>> > background for incoming network traffic with extreme frequency?
>> >  
>> > Best bet is you?re receiving too many events on the socket (INVITE,
>> > or more probably NOTIFY), or like the link says, not reading all the
>> > data from the socket.
>> >  
>> > Best,
>> >  
>> > MarK.
>> >  
>> >  
>> > 
>> > From: pjsip-bounces@xxxxxxxxxxxxxxx [mailto:pjsip-bounces at lists.pjsip.org
>> <mailto:pjsip-bounces at lists.pjsip.org> ]
>> > On Behalf Of Chris Moore
>> > Sent: Saturday, November 12, 2011 20:04
>> > To: pjsip at lists.pjsip.org
>> > Subject: iOS5 background - waking 15 times in 300 seconds
>> > kicking the app
>> > 
>> > Hi,
>> > 
>> > Recently with iOS5 we?ve noticed we?re having these issues
>> > 
>> > Application Specific Information:
>> > SBUnsuspendLimit O2 Connect[293] exceeded 15 wakes in 300 sec
>> > 
>> > The application is being kicked out by the OS.
>> > 
>> > We are using an OpenSIPS server, registration set to 10 minutes (so
>> > we can use the iphone wakeup and re-reg background timed event).
>> > 
>> > The problem is that this happens intermittantly.. ie: something is
>> > really coming up and triggering excessive socket/background wakeups.
>> > 
>> > Just wondering if anyone else is experiencing this and if they?ve be
>> > able to tune the app behaviour or else the server behaviour..
>> > 
>> > Regards,
>> > 
>> > Chris 
>> > 
>> > 
>> > _______________________________________________
>> > Visit our blog: http://blog.pjsip.org <http://blog.pjsip.org/>
>> > 
>> > pjsip mailing list
>> > pjsip at lists.pjsip.org
>> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
>> > 
>> > _______________________________________________
>> > Visit our blog: http://blog.pjsip.org <http://blog.pjsip.org/>
>> > 
>> > pjsip mailing list
>> > pjsip at lists.pjsip.org
>> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
>> > _______________________________________________
>> > Visit our blog: http://blog.pjsip.org <http://blog.pjsip.org/>
>> > 
>> > pjsip mailing list
>> > pjsip at lists.pjsip.org
>> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> <http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org>
> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111113/bc58062b/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux