Game crashing frequently due to shadows?

Hi,

I am currently using Unity 5.2.4f1 and have been trying to fix a crash that occurs when built on iOS. I believe it might have to do with shadows considering the crash log refers to shadow culling.cpp and when I disable shadows for the project the crash does not occur. This error happens at random times and usually appears within 5 - 10 minutes of gameplay. Here is the crash log:

Date/Time: 2016-03-03 14:08:41.41 -0800 Launch Time: 2016-03-03 13:55:18.18 -0800 OS Version: iOS 9.2.1 (13D15) Report Version: 105

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0xb6fd033c Triggered by Thread: 5

Filtered syslog: None found

Breadcrumb Trail: (reverse chronological seconds)

398 disable autoplay

412 enable autoplay

414 enable autoplay

415 disable autoplay

793 GC Framework: startAuthenticationForExistingPrimaryPlayer

Global Trace Buffer (reverse chronological seconds): 128.040714 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x19360069) failed

128.320600 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x144234e9) failed

128.433534 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c33c919) failed

128.540126 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1f9ba0b9) failed

128.540126 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1d3b3ff9) failed

128.625314 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1eca5a49) failed

128.646956 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c979b39) failed

128.692678 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1476a9a9) failed

128.810316 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c9ea759) failed

133.007515 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c9ce6c9) failed

133.924335 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c9c6d89) failed

133.928240 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c9c7009) failed

235.859359 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x147476c9) failed

236.194333 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1f5b3b79) failed

236.481125 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x147b1a89) failed

236.625275 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x412e1d09) failed

236.625275 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1c354bc9) failed

236.881113 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x149b5689) failed

236.915302 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x42ceadb9) failed

236.969498 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1eddfb39) failed

237.160048 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1ed818a9) failed

241.505825 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1eb06b79) failed

241.964911 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1ec706c9) failed

241.971646 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1ec71059) failed

362.925319 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1f894759) failed

363.265686 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x42c21cd9) failed

363.553721 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x19278e19) failed

363.685172 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x42daaab9) failed

363.686463 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x190465b9) failed

363.902375 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x147925e9) failed

363.943819 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1b1f0f69) failed

364.005545 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x193d44b9) failed

364.193344 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x193dedb9) failed

369.302403 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1bf63279) failed

369.637993 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1470ce09) failed

370.185043 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1fd88f59) failed

370.355870 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x1bf52f09) failed

370.356383 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x193fa669) failed

370.561711 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x14769669) failed

370.607333 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x41288ce9) failed

370.671841 libsystem_trace.dylib 0x000000002176c6f9 dyld_image_header_containing_address(0x19108a99) failed

Thread 5 name: UnityWorker Thread 5 Crashed: 0 dhtest 0x005b5646 GenerateCombinedDynamicVisibleListJob(CullResults*) (ShadowCulling.cpp:620)

1 dhtest 0x0071311a JobQueue::Exec(JobInfo*, int, int) (JobQueue.cpp:281)

2 dhtest 0x007131fe JobQueue::ExecuteJobFromHighPriorityStack() (JobQueue.cpp:493)

3 dhtest 0x007132aa JobQueue::ProcessJobs(void*, bool*) (JobQueue.cpp:562)

4 dhtest 0x00712d40 JobQueue::WorkLoop(void*) (JobQueue.cpp:579)

5 dhtest 0x00713d0a Thread::RunThreadWrapper(void*) (Thread.cpp:40)

6 libsystem_pthread.dylib 0x2175ac7e _pthread_body + 138

7 libsystem_pthread.dylib 0x2175abf2 _pthread_start + 110

8 libsystem_pthread.dylib 0x21758a08 thread_start + 8

I have also tried removing any GameCenter related actions and logic (due to the breadcrumb trails), but the crash still occurs, which leads me to believe shadows are the culprit. I have one main directional light, that cast hard shadows in realtime. This crash occurs on both iPhone 5 and 6. This critical crash is the last thing that needs to be fixed before we can release it to the app store, so any help would be greatly appreciated. Thanks!

Could you please create a minimal reproduction project and submit a bug report? Many thanks

Hi, thanks for the reply. On it as we speak.

We are having similar crashes in our game as well. Has anyone discovered a fix for this? Most of our crashes have a stack trace like this:

GenerateCombinedDynamicVisibleListJob(struct CullResults *) Unknown
JobQueue::Exec(struct JobInfo *,__int64,int) Unknown
JobQueue::ProcessJobs(void *,bool *) Unknown
JobQueue::WorkLoop(void *) Unknown
Thread::RunThreadWrapper(void *) Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown

Confirmed same stack traces as jtate5 in our projects as well.

@jtate5 @MR_asilva :
Could you please test on newest version of Unity in your release series and submit a bug report if the bug is still reproducible? Please attach a reproduction project to the submitted bug. The original submitter refused to upload a reproduction project and we couldn’t make a project that reproduces the issue, thus the bug was never fixed.

I recently experienced similar crashes while building to iOS. (Unity 5.4.03f)
It did not seem to affect Windows & OSX builds.

Similar symptoms described in the original post- seemingly random crashes, usually within 5-10 minutes but no discernable pattern-- with Xcode debug pointing to “GenerateCombinedDynamicVisibleListJob” and shadowculling.cpp

I’ve had this happen on two separate occasions and both times it has been resolved by clearing any baked occlusion data.
I haven’t investigated further to see if it was a bad batch or anything like that.

Hope this helps, though.

If you are able to reproduce the issue again and your workaround does not help, please reply here.

We have just had the exact same situation with our app. Removing occlusion data and unsetting occlusion in every camera stops the crash. Very annoying as this hits our framerate, we are using 5.3.7f1.

I too cleared the occlusion data and the crash disappears on iOS. using 5.4.3f1, it seems to be around profile data. However, I tested baking the data with the new version as my occlusion data was before I upgraded and I don’t see the problem anymore. Did you see this issue with a release build?

I thought it’d be worth mentioning that we are currently suffering the same issue, and are getting the exact same stack trace.
Unfortunately it’s proving very hard to reproduce, as only a few of our users are getting the crash, and it hasn’t happened on our systems yet. But, for the users who are getting it, it seems to be pretty high-frequency.
(Ours occurs on Win 64 build using 5.4.1 f1.)

We’re going to try resetting our occlusion data as suggested above.