iPhone crashed with tcpConnWorkQueue EXC_BAD_ACCESS - ios

I have the following stack trace:
Crashed: tcpConnWorkQueue (Not main thread)
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xf000000c
0 libobjc.A.dylib objc_msgSend + 5
1 CoreFoundation CFRelease + 560
2 libdispatch.dylib _dispatch_call_block_and_release + 10
3 libdispatch.dylib _dispatch_queue_drain + 374
4 libdispatch.dylib _dispatch_queue_invoke + 42
5 libdispatch.dylib _dispatch_root_queue_drain + 76
6 libdispatch.dylib _dispatch_worker_thread2 + 56
7 libsystem_pthread.dylib _pthread_wqthread + 298
All the other stacks look unrelated to my code. What does this stack trace mean? And where can I look for faults in my code that may lead to something like this?
Main thread stack look like this:
Thread : com.apple.main-thread
0 QuartzCore 0x2fedef34 CA::Render::Object::unref() const + 35
1 QuartzCore 0x2fedda73 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 142
2 QuartzCore 0x2fedda73 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 142
3 QuartzCore 0x2fedaa23 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 314
4 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
5 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
6 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
7 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
8 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
9 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
10 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
11 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
12 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
13 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
14 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
15 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
16 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
17 QuartzCore 0x2feda9c1 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 216
18 QuartzCore 0x2fed8d41 CA::Context::commit_transaction(CA::Transaction*) + 1048
19 QuartzCore 0x2fed881f CA::Transaction::commit() + 314
20 QuartzCore 0x2ff2d929 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 516
21 IOMobileFramebuffer 0x32b5d76d IOMobileFramebufferVsyncNotifyFunc + 104
22 IOKit 0x2e7b4be5 IODispatchCalloutFromCFMessage + 248
23 CoreFoundation 0x2da92b81 __CFMachPortPerform + 136
24 CoreFoundation 0x2da9d777 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
25 CoreFoundation 0x2da9d713 __CFRunLoopDoSource1 + 346
26 CoreFoundation 0x2da9bedf __CFRunLoopRun + 1406
27 CoreFoundation 0x2da06471 CFRunLoopRunSpecific + 524
28 CoreFoundation 0x2da06253 CFRunLoopRunInMode + 106
29 GraphicsServices 0x327402eb GSEventRunModal + 138
30 UIKit 0x302bb845 UIApplicationMain + 1136

The stack trace, at level 1, shows a CFRelease has been called, but your address 0xf000000c is invalid according to the kernel, resulting in a bad access exception. This happens when a message is sent to an object already released, in the most common case.
This type of crash usually has a time lag between when the object was first released, and when it was released a second time. However, you have code which triggers when the screen is updated because you have a 0x2ff2d929 CA::Display::DisplayLink::dispatch_items.
The screen updates frequently so this should be called often.
Have you used + (CADisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel anywhere in your program? Do you have any - (void)invalidate calls?
It could be that the user interface is switching from one use case (say playing a game with display timer based screen updates) to another (say presenting a menu choice when the game ends). When this kind of switch occurs, the code assumptions are invalidated, so you have to cancel your callbacks, else you get a final callback when things are not setup right (you draw a frame of a game when actually its time to present menus).
When you run your program with Zombies enabled -- a tick box in the Schema section, then any Released object is made a "zombie" - it lingers around waiting for calls to be made on the object. When any call comes in, it knows its a programming error and aborts. Then you can look back at the allocation history of that object to see where it was first allocated and released to identify the double-release bug.

Related

Are CA::Render::Encoder::grow crashes due to a bug in iOS 13, or how to fix them?

(I've found some other QuartzCore crash related questions on StackOverflow but none of them are for the exact context that we have.)
We have an iOS app in the App Store. Recently, we see in Organizer / Crashes for that app a new type of crash that seems bound to iOS 13 devices (21 devices affected in the last few weeks, all with iOS 13.1, .2, or .3). Xcode reports that the crashes occurred in QuartzCore, on CA::Render::Encoder::grow(unsigned long).
Any idea what can it be and how it could be fixed? It doesn't look related to our code. Can it be a recent Apple bug? (We didn't have these crash reports before iOS 13.) Thank you in advance.
Here is an extract from the crash log:
OS Version: iPhone OS 13.3 (17C54)
Release Type: User
Baseband Version: 2.03.07
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001b431aefc __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001b423a8b8 pthread_kill + 228 (pthread.c:1458)
2 libsystem_c.dylib 0x00000001b41caa74 abort + 104 (abort.c:110)
3 QuartzCore 0x00000001bb0fc3b0 CA::Render::Encoder::grow(unsigned long) + 308 (render-coding.cpp:562)
4 QuartzCore 0x00000001bb0fcb20 CA::Render::Encoder::encode_data_async(void const*, unsigned long, void (*)(void const*, void*), ... + 180 (render-coding.h:272)
5 QuartzCore 0x00000001bafb2f78 CA::Render::Image::encode(CA::Render::Encoder*) const + 740 (render-image.cpp:401)
6 QuartzCore 0x00000001bb0fc438 CA::Render::Encoder::encode_object_uncached(CA::Render::Object const*) + 136 (render-coding.cpp:905)
7 QuartzCore 0x00000001bafcf9d4 CA::Render::Layer::encode(CA::Render::Encoder*) const + 116 (render-coding.h:388)
8 QuartzCore 0x00000001bb0fc438 CA::Render::Encoder::encode_object_uncached(CA::Render::Object const*) + 136 (render-coding.cpp:905)
9 QuartzCore 0x00000001bb100ebc CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Obje... + 196 (render-coding.cpp:2151)
10 QuartzCore 0x00000001bb04094c invocation function for block in CA::Context::commit_transaction(CA::Transaction*, double) + 1080 (CAContextInternal.mm:1632)
11 QuartzCore 0x00000001bb0fae1c CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 348 (CALayer.mm:2647)
12 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
13 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
14 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
15 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
16 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
17 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
18 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
19 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
20 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
21 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
22 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
23 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
24 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
25 QuartzCore 0x00000001bb0fad98 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block... + 216 (CALayer.mm:2633)
26 QuartzCore 0x00000001bb03fbc4 CA::Context::commit_transaction(CA::Transaction*, double) + 2868 (CAContextInternal.mm:2288)
27 QuartzCore 0x00000001bb069fd0 CA::Transaction::commit() + 684 (CATransactionInternal.mm:438)
28 UIKitCore 0x00000001b8648d60 _afterCACommitHandler + 144 (UIApplication.m:3076)
29 CoreFoundation 0x00000001b44ab524 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1758)
30 CoreFoundation 0x00000001b44a61c4 __CFRunLoopDoObservers + 420 (CFRunLoop.c:1868)
31 CoreFoundation 0x00000001b44a6774 __CFRunLoopRun + 1292 (CFRunLoop.c:2910)
32 CoreFoundation 0x00000001b44a5f40 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)
33 GraphicsServices 0x00000001be723534 GSEventRunModal + 108 (GSEvent.c:2246)
34 UIKitCore 0x00000001b861ea60 UIApplicationMain + 1940 (UIApplication.m:4773)
35 <OurĀ appĀ name> 0x00000001029ed048 main + 88 (main.m:14)
36 libdyld.dylib 0x00000001b4324e18 start + 4

How to fix iOS crash " com.apple.main-thread SIGABRT ABORT"

I'm facing a crash occured 10 times from fabric log. But I can't reproduce it when connecting Xcode.
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill$VARIANT$mp + 380
2 libsystem_c.dylib abort + 140
3 QuartzCore CA::Render::Encoder::encode_object_uncached(CA::Render::Object const*) + 366
4 QuartzCore CA::Render::Encoder::encode_data_async(void const*, unsigned long, void (*)(void const*, void*), void*) + 212
5 QuartzCore CA::Render::Image::encode(CA::Render::Encoder*) const + 636
6 QuartzCore CA::Render::Layer::encode(CA::Render::Encoder*) const + 128
7 QuartzCore CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Object*, unsigned int) + 192
8 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 484
9 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
10 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
11 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
12 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
13 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
14 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
15 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
16 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
17 QuartzCore CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
18 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 3028
19 QuartzCore CA::Transaction::commit() + 640
20 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
21 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
22 CoreFoundation __CFRunLoopDoObservers + 412
23 CoreFoundation __CFRunLoopRun + 1228
24 CoreFoundation CFRunLoopRunSpecific + 436
25 GraphicsServices GSEventRunModal + 104
26 UIKitCore UIApplicationMain + 212
27 ChopeDashboard main.m line 14 main + 14
28 libdyld.dylib start + 4
Do you guys know how to resolve it?
Thanks very much!

Quartzcore crash calling CA::Render::Encoder::encode_object_uncached(CA::Render::Object const*)

Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x195eca0dc __pthread_kill + 8
1 libsystem_pthread.dylib 0x195f479b0 pthread_kill$VARIANT$armv81 + 296
2 libsystem_c.dylib 0x195e23ea8 abort + 140
3 QuartzCore 0x19a7f40bc CA::Render::Encoder::encode_object_uncached(CA::Render::Object const*) + 366
4 QuartzCore 0x19a855844 CA::Render::Array::encode(CA::Render::Encoder*) const + 112
5 QuartzCore 0x19a6dcc08 CA::Render::Layer::encode(CA::Render::Encoder*) const + 140
6 QuartzCore 0x19a7f8d08 CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Object*, unsigned int) + 192
7 QuartzCore 0x19a7f27e8 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 484
8 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
9 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
10 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
11 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
12 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
13 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
14 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
15 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
16 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
17 QuartzCore 0x19a7f2708 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
18 QuartzCore 0x19a749d48 CA::Context::commit_transaction(CA::Transaction*) + 3028
19 QuartzCore 0x19a777330 CA::Transaction::commit() + 640
20 QuartzCore 0x19a777f20 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
21 CoreFoundation 0x1962be5f8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
22 CoreFoundation 0x1962b9320 __CFRunLoopDoObservers + 412
23 CoreFoundation 0x1962b989c __CFRunLoopRun + 1228
24 CoreFoundation 0x1962b90b0 CFRunLoopRunSpecific + 436
25 GraphicsServices 0x1984b979c GSEventRunModal + 104
26 UIKitCore 0x1c2b25978 UIApplicationMain + 212
27 Her 0x1041919f8 main + 11 (main.swift:11)
28 libdyld.dylib 0x195d7e8e0 start + 4
The only info in regards to what may be causing this is Failed to allocate 49152 bytes, requested = 4, old size = 24400
While trying to investigate potential causes for this crash i have found:
iOS app crashing with cfrunloop_is_calling_out_to_an_observer_callback_function
and
https://forums.developer.apple.com/thread/100012
which are in conflict as to what they thing is the cause of this crash.
The issue I am having is essentially: I am seeing this occur with a number of my users but I have yet been able to reproduce this crash on simulator or my personal device.
I am unclear and uncertain on how to proceed with even debugging this issue as a result and could use some advice on what potential code patterns to look for as a potential cause. I know this isn't a specific question with a determinable answer but could really use some assistance with this.

iOS 12-only QuartzCore crash on com.apple.coremedia.player.async

I've got a crash report on QuartzCore, which seems to only happened on iOS 12. It crashed on com.apple.coremedia.player.async.
I've found several similar reports on Apple Developer Forums, but there is no solution provided yet.
Here is the full stack trace (iOS 12.0.1) :
Crashed: com.apple.coremedia.player.async.0x283b5c240
0 QuartzCore 0x18f8ad578 X::Ref<CA::Shape>::operator=(CA::Shape*) + 20
1 QuartzCore 0x18f8ad434 CABackingStoreGetFrontTexture(CABackingStore*, CGColorSpace*) + 348
2 QuartzCore 0x18f8ad2a8 CABackingStoreRetainFrontTexture + 48
3 QuartzCore 0x18f9d4e54 -[CALayer(CALayerPrivate) _copyRenderLayer:layerFlags:commitFlags:] + 676
4 QuartzCore 0x18f9da9e4 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 448
5 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
6 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
7 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
8 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
9 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
10 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
11 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
12 QuartzCore 0x18f9da928 CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 260
13 QuartzCore 0x18f92e528 CA::Context::commit_transaction(CA::Transaction*) + 3240
14 QuartzCore 0x18f95c2f4 CA::Transaction::commit() + 608
15 MediaToolbox 0x18fe4d300 remoteXPCPlayer_setClientVideoLayerArray + 1284
16 MediaToolbox 0x18fe4c598 remoteXPCPlayer_SetProperty + 340
17 MediaToolbox 0x18fdb362c playerasync_runOneCommand + 1876
18 MediaToolbox 0x18fdb63d0 playerasync_runAsynchronousCommandOnQueue + 172
19 libdispatch.dylib 0x18ae20484 _dispatch_client_callout + 16
20 libdispatch.dylib 0x18adc7c18 _dispatch_lane_serial_drain$VARIANT$mp + 592
21 libdispatch.dylib 0x18adc8794 _dispatch_lane_invoke$VARIANT$mp + 484
22 libdispatch.dylib 0x18adcfa60 _dispatch_root_queue_drain + 376
23 libdispatch.dylib 0x18adcf7e0 _dispatch_worker_thread + 284
24 libsystem_pthread.dylib 0x18b0012fc _pthread_body + 128
25 libsystem_pthread.dylib 0x18b00125c _pthread_start + 48
26 libsystem_pthread.dylib 0x18b004d08 thread_start + 4
I have absolutely no clue to determine where it could come from. The crash log suggests that it could come from video, and my app contains a Youtube Player, so it may be related.
Does anybody have an idea ? Please tell me if you need additional information.

Crash whilst iOS takes app snapshot

Update: 14th April 2016: Still seeing these crashes in Fabric Crashlytics, and still not sure how I would go about fixing. Seems to be a session crash rate of 0.2%.
As far as I can see, my app is very occasionally crashing when Apple takes a snapshot (as the snippet below is in the crash log). However, I'm not sure how I can stop it from crashing.
[UIApplication _updateSnapshotAndStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:]
I have found a few other posts on SO, but I don't use any kind of WebView (post), does not use any ads, and calls the completionHandler in the main thread. etc. Other people also seem to experience similar issues, but their post remains unanswered. The entire crash log is below. Is this a bug with Apple's internals, or is it something which I can potentially fix?
Thread : Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x1812962a0 _platform_memmove + 176
1 CoreFoundation 0x181544ed8 CFDataGetBytes + 172
2 CoreFoundation 0x181544ed8 CFDataGetBytes + 172
3 ImageIO 0x182cb599c CGImageReadGetBytesAtOffset + 624
4 ImageIO 0x182cb570c CGImageReadSessionGetBytes + 36
5 ImageIO 0x182d89acc iioReadCallback + 32
6 AppleJPEG 0x182c8bd04 aj_istream_move_to_position + 488
7 AppleJPEG 0x182c8c968 aj_istream_state_restore + 60
8 AppleJPEG 0x182c9b64c applejpeg_decode_set_ra_table + 804
9 ImageIO 0x182d8e1e0 copyImageBlockSetAppleJPEG + 6524
10 ImageIO 0x182cbf130 ImageProviderCopyImageBlockSetCallback + 852
11 QuartzCore 0x183d5ae0c CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int) + 972
12 QuartzCore 0x183d59eec CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double) + 372
13 QuartzCore 0x183d32f00 -[CALayer(CALayerPrivate) _copyRenderLayer:layerFlags:commitFlags:] + 484
14 QuartzCore 0x183d32c54 CA::Context::commit_layer(CA::Layer*, unsigned int, unsigned int, void*) + 108
15 QuartzCore 0x183d2f9cc CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 392
16 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
17 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
18 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
19 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
20 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
21 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
22 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
23 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
24 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
25 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
26 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
27 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
28 QuartzCore 0x183d2f95c CA::Layer::commit_if_needed(CA::Transaction*, void (*)(CA::Layer*, unsigned int, unsigned int, void*), void*) + 280
29 QuartzCore 0x183d2d0cc CA::Context::commit_transaction(CA::Transaction*) + 1332
30 QuartzCore 0x183d2c9dc CA::Transaction::commit() + 512
31 UIKit 0x1865ab768 _UIWindowUpdateVisibleContextOrder + 236
32 UIKit 0x1865ab5b4 +[UIWindow _prepareWindowsPassingTestForAppResume:] + 32
33 UIKit 0x1865e1468 __114-[UIApplication _updateSnapshotAndStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:]_block_invoke_3 + 72
34 libdispatch.dylib 0x181089630 _dispatch_call_block_and_release + 24
35 libdispatch.dylib 0x1810895f0 _dispatch_client_callout + 16
36 libdispatch.dylib 0x18108ecf8 _dispatch_main_queue_callback_4CF + 1844
37 CoreFoundation 0x1815ecbb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
38 CoreFoundation 0x1815eaa18 __CFRunLoopRun + 1628
39 CoreFoundation 0x181519680 CFRunLoopRunSpecific + 384
40 GraphicsServices 0x182a28088 GSEventRunModal + 180
41 UIKit 0x186390d90 UIApplicationMain + 204
42 MyApp 0x100095888 main (main.m:16)
43 libdispatch.dylib 0x1810ba8b8 (Missing)
It's a pretty good bet that something somewhere is triggering UIKit manipulations on a background thread. Finding exactly what ... well that's a trick. With a little luck, this gist may be of help.
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.
If you have any ad display SDKs in your app, that would be an excellent first suspicion. They have a depressing habit of being absolutely horrible at correctly confining UI manipulations to the main thread.

Resources