We are running 5.0.1P1 I’m not sure when this crash started happening, but it must be sometime within the last 3 weeks.
We have an intermittent crash that occurs when we are transitioning from some of our main game scenes to the FE / results screens etc. It occurs maybe 15% of the time and seems quite random.
I have tried to get some crash log information, I have only reproduced this problem with Release,IL2CPP, Arm 64 builds so far. It didn’t seem to occur when I was using Mono runtime… (from what I could tell). I have never seen this crash in the Editor, only on iOS builds.
It makes sense that it’s crashing during the cleanup of the scene as my main game scenes will be unloading at the point it crashes so we can load in the FE/Result scenes.
This is after selecting Re-Symbolicate log from the Device logs window. I have tried to make sure I have my XCode project setup to give me all the debug info, I am using this post process step to set that up for me:
Can anyone shed any light on what I could do to try and track this further? I can’t reproduce this in a simple project so reporting as a bug with an example is pretty much out of the question.
This is occurring after destroying GameObjects that had Animations using AnimationClips.
I haven’t yet tried this on 5.0.1p2, but the patch log does not look like it would solve this issue. I also haven’t tried going back to 5.0.1f1, but that is likely my next step in debugging, which unfortunately means re-implementing all the workarounds for HTTPS, generic type reflection and non-colored vertex meshes.
We also think it started in 5.0.1p1 (based on when I sent out a Unity upgrade e-mail and when we first got reports about crashes).
We are just about to try 5.0.1p3 which has a fix for:
(684129) - iOS/IL2CPP: Match the behavior of the Mono scripting backend by not stripping the Animation code from the engine when code stripping is enabled.
Could be related…
Let me know if you try 5.0.1f1 and it fixes the problem, I’ll do the same with 5.0.1p3.
I don’t suppose you have any sort of repro project you could submit with a bug report? I mentioned this crash in the semi official IL2CPP support thread and they asked for a repro case. Unfortunately, we haven’t been able to repro outside of our project (which we can’t submit to Unity).
I tried 5.0.1p3 today, and it worked for me. Then I saw your post on how you were still seeing the issue and that got me thinking on what I was doing differently. I had put in a few potential workarounds to try and get around the bug when building against 5.0.1p1, so I took those out and saw the crashing again immediately.
The workarounds I did were:
The AnimationClips I had were being re-used in multiple Animations. I was just instantiating one version of each clip and assigning them to whichever Animation needed to use it. I changed that to instantiate a new AnimationClip each time one was being added to an Animation.
Also, on any GameObject that had an Animation component, I added an OnDestroy which would call Animation.Stop and Animation.RemoveClip for every AnimationClip.
With this combination, I haven’t seen the crash again. Although I haven’t done a long term test to see if this just ends up masking the issue for longer. But it went from crashing within the first 2 times of creating and destroying a number of animating GameObjects, to being able to run that cycle tens of times without issue.
I still haven’t been able to put together a simple test project to replicate the issue, but have some better ideas now that these workarounds seem to be doing something. I’m also in a position where I cannot submit the full project to Unity for bug reporting.
I am getting the same errors, the problem is, it happen randomly and i cant reproduce the problem
I’ve tried it on 5.0.1p1 - 5.0.1p3 IOS builds
here is the log in xcode:
BatchDeleteObjects (10) #0 0x01a3ccbb in il2cpp:s::ThreadImpl::GetCurrentThread() () #1 0x01a38ede in il2cpp:s::posix::posixWaitObject::Wait(unsigned int, bool) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/PosixWaitObject.cpp:90 #2 0x01a38a9f in il2cpp:s::MutexImpl::TryLock(unsigned int, bool) [inlined] at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/MutexImpl.cpp:39 #3 0x01a38a7b in il2cpp:s::MutexImpl::Lock(bool) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/MutexImpl.cpp:26 #4 0x01a332cb in il2cpp:s::Mutex::Lock(bool) at /Users/builduser/buildslave/unity/build/Runtime/Threads/Mutex.cpp:30 #5 0x01a14530 in il2cpp::gc::GCHandle::GetTarget(unsigned int) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/gc/GCHandle.cpp:186 #6 0x01285006 in ~TrackedReferenceBase at /Users/builduser/buildslave/unity/build/./Runtime/BaseClasses/RefCounted.h:23 #7 0x012473a6 in ReleaseAnimationStates at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.cpp:1886 #8 0x0124f85b in ThreadedCleanup [inlined] at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.cpp:67 #9 0x0124f853 in ~Animation at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.h:84 #10 0x00da2235 in delete_object_internal_step2 at /Users/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.cpp:1329 #11 0x00f48f57 in BatchDeleteStep2Threaded at /Users/builduser/buildslave/unity/build/Runtime/Misc/BatchDeleteObjects.cpp:105 #12 0x00ff3f2f in RunThreadWrapper at /Users/builduser/buildslave/unity/build/Runtime/Threads/Thread.cpp:40 #13 0x08ddce13 in _pthread_body () #14 0x08ddcd89 in _pthread_start () #15 0x08ddae52 in thread_start ()
I think I’m running into this as well. Happens randomly when I try to leave certain scenes and go to a new one. It doesn’t happen all the time on those scenes … just randomly. It used to happen a lot more frequently, but setting the iOS to 8.0 and Disabling stripping level in IL2CPP seems to have helped. However, it still seems to happen and I do get the same error message in Xcode around delete objects.
I’m going to try the animation workarounds that were suggested and see if that helps. I may also be able to provide a bug report and reproduction case.
So after doing some longer tests, I ended up still hitting the BatchDeleteObjects crash. I have gone back to 5.0.1f1, and have not gotten the crash since, so it seems to confirm that the bug was introduced with the 5.0.1p1 patch.
Also seeing this 5.0.1p1->p3 - can repro 100% of the time when trying to transition scenes, will attempt the animation fixes - sadly also cannot submit my project to unity - hopefully they will jump on the bug report - jumping from one broken version of unity to another is getting tiring.
Here is my stack :
#0 0x0242d0cc in il2cpp::os::ThreadImpl::GetCurrentThread() () #1 0x02428c54 in il2cpp::os::posix::PosixWaitObject::Wait(unsigned int, bool) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/PosixWaitObject.cpp:90 #2 0x024285f8 in il2cpp::os::MutexImpl::TryLock(unsigned int, bool) [inlined] at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/MutexImpl.cpp:39 #3 0x024285d4 in il2cpp::os::MutexImpl::Lock(bool) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/os/Posix/MutexImpl.cpp:26 #4 0x023fb808 in il2cpp::gc::GCHandle::GetTarget(unsigned int) at /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/gc/GCHandle.cpp:186 #5 0x01f2dc90 in ~TrackedReferenceBase at /Users/builduser/buildslave/unity/build/./Runtime/BaseClasses/RefCounted.h:23 #6 0x01eef024 in ReleaseAnimationStates at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.cpp:1886 #7 0x01eeef64 in ThreadedCleanup at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.cpp:67 #8 0x01ef8034 in ~Animation at /Users/builduser/buildslave/unity/build/Runtime/Animation/Animation.h:84 #9 0x01ba2ca0 in delete_object_internal_step2 at /Users/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.cpp:1329 #10 0x01d15d70 in BatchDeleteStep2Threaded at /Users/builduser/buildslave/unity/build/Runtime/Misc/BatchDeleteObjects.cpp:105 #11 0x01dbd8b8 in RunThreadWrapper at /Users/builduser/buildslave/unity/build/Runtime/Threads/Thread.cpp:40 #12 0x38e22e66 in _pthread_body () #13 0x38e22dda in _pthread_start () #14 0x38e20b84 in thread_start ()
Do a manual animation cleanup before doing Application.LoadLevelAsync transitions seems to be a functional workaround :
Thanks for the input though group, saved me a ton of work.
I’m starting to run into the crash again … I’m going to try your code. I take it is just a function you run right before you running Application.LoadLevelAsynch?
What type of exception did you catch for? Was it a null reference exception … occurring if a was null, for example? Do you mind just adding that to the original code you shared?
Specifically what type of Exception do you try to catch for? If I try the generic Exception that you have in the code, Unity kicks up an error. Is it a UnityException or one of the other types?