Search Unity

iOS iPad Crash/Reboot

Discussion in 'iOS and tvOS' started by Malveka, Nov 14, 2010.

  1. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I'm currently experiencing a problem when running my game on the iPad, which causes the iPad to suddenly stop responding and then reboot. It's not simply crashing out of the game, but, each and every time, causes the device to reboot itself.

    I had seen this happen 3 or 4 times over the last month but I could never recreate it deliberately. It seems that some of the changes I made yesterday have sensitized it, because now it's happening more frequently. Unfortunately, there is no crash log generated on the device when it crashes in this way. So there's no information to be had from that source.

    Based on posts here and the Apple dev forums, I've been examining the Unity internal profiler and the Xcode leaks instrument looking for memory problems. I don't see anything that looks problematic, though I must admit to not being very experienced using either of these tools. Here are the last couple of profiler stanzas just before a crash:

    iPhone Unity internal profiler stats:
    cpu-player> min: 4.4 max: 46.1 avg: 28.5
    cpu-ogles-drv> min: 1.0 max: 8.8 avg: 1.7
    cpu-waits-gpu> min: 0.9 max: 39.8 avg: 12.2
    cpu-present> min: 0.2 max: 27.7 avg: 3.5
    frametime> min: 15.1 max: 61.7 avg: 36.7
    draw-call #> min: 18 max: 20 avg: 18 | batched: 46
    tris #> min: 774 max: 1116 avg: 1053 | batched: 203
    verts #> min: 1548 max: 2232 avg: 2106 | batched: 406
    player-detail> physx: 0.7 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.2 render: 12.3 fixed-update-count: 0 .. 4
    mono-scripts> update: 2.1 fixedUpdate: 0.0 coroutines: 0.2
    mono-memory> used heap: 1650688 allocated heap: 2953216 max number of collections: 0 collection total duration: 0.0
    ----------------------------------------
    iPhone Unity internal profiler stats:
    cpu-player> min: 27.1 max: 32.0 avg: 29.3
    cpu-ogles-drv> min: 1.1 max: 1.7 avg: 1.3
    cpu-waits-gpu> min: 5.2 max: 20.7 avg: 13.1
    cpu-present> min: 0.2 max: 5.9 avg: 3.8
    frametime> min: 35.1 max: 37.6 avg: 36.1
    draw-call #> min: 18 max: 19 avg: 18 | batched: 46
    tris #> min: 1086 max: 1116 avg: 1100 | batched: 193
    verts #> min: 2172 max: 2232 avg: 2200 | batched: 387
    player-detail> physx: 0.7 animation: 0.0 culling 0.0 skinning: 0.0 batching: 0.1 render: 11.9 fixed-update-count: 1 .. 2
    mono-scripts> update: 2.6 fixedUpdate: 0.0 coroutines: 0.1
    mono-memory> used heap: 1654784 allocated heap: 2953216 max number of collections: 0 collection total duration: 0.0
    ----------------------------------------
    Watchdog has expired. Remote device was disconnected? Debugging session terminated.
    Watchdog has expired. Remote device was disconnected? Debugging session terminated.

    The Debugger has exited due to signal 15 (SIGTERM).The Debugger has exited due to signal 15 (SIGTERM).


    I'm running with Unity3.0 Pro + iOS Pro and iOS 3.2.1 on the device.

    It's got me stumped... Any suggestions on how to proceed to get to the bottom of this would be most welcome!

    Thanks,
    Mal
     
  2. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I've upgraded to Unity 3.1 and iOS 3.2.2 on the iPad on the chance that one of these help. No luck--the problem persists.

    I'm wondering if this could be a heat problem. I've seen problems like this in PCs when the graphics chip overheats for one reason or another. Has anyone encountered or heard of overheat issues on the iPad? My app is definitely rendering bound and pushing the gpu for all its worth. Still, I imagine this is not all that unusual, so I would expect others to be hitting similar problems if the iPad was susceptible to heat issues.

    Grasping at straws... o.o

    Mal
     
  3. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    You are grasping at straws, but I'm getting something similar on my iPhone 4. I have iOS v4.2 on the device, and my game will run 5-6 times perfectly, but then crash on the next one, resetting the device completely. The frustrating thing about this is the fact that because of the severity of the crash, the device doesn't store a crash-log, so I have no idea how to track down the issue.

    Is it a bug in Unity 3? It's reproducable, but only when the game is run on the device - not when it's run in the editor...?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    going to have to comment out big blocks till you get to the root of the problem. if that doesn't solve it, try with just a sphere on screen. got to isolate this one lads...
     
  5. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    Personally, I'm pretty sure it's a bug in Unity. As the whole system is a managed code-base, we shouldn't really be able to do anything beyond crash our own program if we're using the core Unity API (i.e. no Objective C plugins).

    It really is a problem, though - and no word from Unity on it as yet... :(
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    And unity itself can only use API thats provided by apple so if it crashes its an iOS bug as unity can't use private API (ie "functionality beyond the supported and documented layer") either :)

    I've seen such crashes several times in the past with a plentitude of applications including pure native UIKit applications without any gaming aspects and basically on about any device.
    Can't say how to get there aside of the case where an application does hard lock in which case iOS will reboot to get rid of the process (this is something unity can't create as normally all processes respond to the kill request from iOS, if they don't then samething went seriously wrong on a very low OS level
     
  7. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    Dreamora: Yes, everything you say makes sense, but that being the case, surely we'd see this kind of hard reset action on loads of applications - but we don't?

    I appreciate the way that iOS and indeed OSX works, from the point of view that it segments memory to prevent stuff like this happening, but there is something going wrong somewhere along the line.

    My best guess (at the moment) would be that it's something to do with Instantiate in my case. This would then lead me to believe that it was some kind of memory management issue? I've put some code in place to force the garbage collection to work very second or so, which I'll try this evening, but it still feels like a Unity bug rather than Apple to me...
     
  8. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    Funny this thread should come back to life just now...

    I've been chasing this problem hard for the last two weeks. I followed a lot of blind alleys to dead-ends, but learned a good amount along the way. :p Yesterday I finally managed to create a minimal project that could recreate the crash/reboot. This project contains:

    - A camera
    - A particle system
    - A script on the camera that creates a rendertexture and uses Graphics.Blit() to apply a fullscreen effect.

    As near as I can tell, Graphics.Blit() is the culprit. I submitted a bug report to Unity (case 383751) yesterday - 11/28/2010.

    I finally arrived at this testcase by noticing that it appeared my app was only crashing when I had a certain image effect turned on (the notorious GlowEffect - yes, it's really slow on the devices, but my app, which is not a traditional game, can be quite satisfactory at pretty low frame rates). So, I started stripping stuff out of the GlowEffect.cs script and finally had just a few lines remaining, namely two Graphics.Blit() calls. It still requires some time to get the app to crash on the device. It may have to run anywhere from 5 - 30 minutes, but it will eventually crash. I've run this thing time and time again using Instruments - Activity Monitor and it does not appear to be memory related. I've seen it crash with Instruments reporting there is still 100MB of Physical Memory free.

    Starbuck - are you using any image effects or other scripts that make use of Graphics.Blit()?

    Good Luck!
    Mal
     
  9. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I went down exactly the same road. Had code in my app to force garbage collection every 1 second and display the current heap size. I saw crashes when my app was just sitting there, with the heap size holding rock steady. It'll be interesting to see what results you get. I actually found the Instruments tool to be quite useful for seeing what was really going on with memory from a big picture point of view. I found at least one memory problem in my app where memory was being consumed, but it did not show up in my heap usage.

    Cheers,
    Mal
     
  10. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    One further piece of information: I made a post on the Apple developer forums about this issue but got no replies. You can find it here if you're curious: Apple Dev Forum Post
     
  11. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    Yeah, I do use screen effects - a lot of them. Vignetting, and motion blur, as well as desaturate...

    Would be very interested to hear what you get back from Unity - I need this one fixed like yesterday!
     
  12. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    I'll let you know when I hear something.

    It would be interesting to see what would happen if you could disable all your image effects. Would it eliminate the crash for your app as well?

    Cheers,
    Mal
     
  13. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    Yup - tried it last night. Without the effects (well, Vignetting in particular), it doesn't seem to do it. My test cycle was to play the game 15 times to see if it crashed, and it didn't, once. This is in contrast to crashing every 4-5 times it's played with the effects in place.

    This is a bit of a show-stopper for me - it really needs to be fixed as a matter of urgency; We can't wait until the next full update of Unity for this to be sorted... :(
     
  14. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    Very good to know. That adds weight to favor the idea that our crashes have one and the same cause.

    I too need this problem fixed as soon as possible. I've invested a great deal of time in running it to ground. Enough to slip my app release schedule. Hopefully my simple crash project will give the Unity folks everything they need to recreate the problem easily and pinpoint the source. And hopefully that source is one they can fix. Keeping all prehensile appendages interlaced! :p

    Mal
     
  15. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    FYI, I got a reply to an e-mail query I made to support about the state of this problem:

    "I checked up on the progress of this bug today using the bug number that was given in the forum thread. It has been investigated by our QA team and as of today has now been issued to our development team with the highest priority for fixing.
    Sorry that there is no good news regarding this at the moment. When the fix for this comes I would expect that it would be identified in the release notes as it is a show stopping bug."

    This implies to me that they have been able to recreate the bug and recognize it seriousness. Hopefully a fix is not too far off.

    Cheers,
    Mal
     
  16. ugur

    ugur

    Joined:
    Jun 3, 2008
    Posts:
    692
    Yeah, i experienced such a crash/ auto reboot bug in one of my games, too. I´m pretty sure it is unity side and not iOS side because with older unity versions what would happen would be the game freezes, the last image is shown briefly and then the device goes out and reboots. In newest unity versions what happens is that right before the device goes out the last game screen shown shows as if it would have a weird heat display kinda effect. So yeah, something changed there and due to what happens i think it is some kind of graphics/openGL handling related bug. I flagged a bug report on it a while back, too but sadly couldn´t narrow it down further either because the device in such hard crash auto reboot situation doesn´t give any feedback anymore, so no debugger output, crash log etc.
    Well, i hope the UT fellas find the source =)
    To me it happened very rarely, but yeah, it sure is an ugly one.
     
  17. BigRedSwitch

    BigRedSwitch

    Joined:
    Feb 11, 2009
    Posts:
    724
    It's a bit of an odd one for me - generally it's every 4-5 times I play my game, but but I've seen it happen several times in quick succession. It really is a showstopper - I think I'd be in for horrendous reviews if I submitted whilst this is in place - ir really does need to be fixed as a matter of priority... :(
     
  18. Bowie-Xu

    Bowie-Xu

    Joined:
    Sep 14, 2011
    Posts:
    28
    Hi guys
    Has the problem been solved or not?
    We have same problem, our game make ipod touch 3 reboot, but it's ok on iphone4, iphone3GS, ipad and ipad2.
    The UNITY version is 3.4.

    Thanks!
     
  19. Malveka

    Malveka

    Joined:
    Nov 6, 2009
    Posts:
    191
    Bowie, sorry for the delayed response.

    For me, this crash appears to have been resolved by the release of iOS4.2. In the end I changed my app to recognize the level of iOS on which it was running and exclude the feature that caused crashing on versions earlier than iOS4.2.

    The app has been released and there have been no crash reports thus far.

    Cheers,
    Mal
     
  20. Saddamjit_Singh

    Saddamjit_Singh

    Joined:
    Dec 4, 2015
    Posts:
    22
    Getting memory warning on iOS and then getting message "Terminated because of memory issue" and game crashes.

    Any way out?