I have a little puzzle to solve... Our app is crashing on launch (the dreaded badf00d
error, it's taking more than 5 seconds to launch) but we are not able to reproduce the issue. I was able to get crash logs from users. Unfortunately, I don't have the .ipad to symbolicate the crash entirely (stupid error).
However, I'm wondering if it's not possible to find out what's going on from the backtrace. It seems that there is a deadlock happening in some security code. It also seems that this happens when trying to load the main view. Is there any chance that this would be code signing related? Any insight would be helpful!
Date/Time: 2014-10-02 23:34:23.472 +1000
Launch Time: 2014-10-02 23:34:03.057 +1000
OS Version: iOS 8.0.2 (12A405)
Report Version: 105
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Highlighted Thread: 0
Application Specific Information:
com.myappsoftware.myapp failed to scene-create in time
Elapsed total CPU time (seconds): 4.230 (user 4.230, system 0.000), 10% CPU
Elapsed application CPU time (seconds): 1.039, 3% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x36360540 semaphore_wait_trap + 8
1 libdispatch.dylib 0x36297eee _dispatch_semaphore_wait_slow + 186
2 libxpc.dylib 0x364077b8 xpc_connection_send_message_with_reply_sync + 152
3 Security 0x2b8dd310 securityd_message_with_reply_sync + 64
4 Security 0x2b8dd48c securityd_send_sync_and_do + 44
5 Security 0x2b8ea452 __SecItemCopyMatching_block_invoke + 166
6 Security 0x2b8e96f6 SecOSStatusWith + 14
7 Security 0x2b8ea36e SecItemCopyMatching + 174
8 My App 0x003e6db2 0x3a000 + 3853746
9 My App 0x0006bcd0 0x3a000 + 203984
10 My App 0x0006bd28 0x3a000 + 204072
11 My App 0x0006c8c4 0x3a000 + 207044
12 My App 0x0004bf7e 0x3a000 + 73598
13 UIKit 0x2bb1e12a -[UIViewController loadViewIfRequired] + 598
14 UIKit 0x2bbc7e00 -[UINavigationController _layoutViewController:] + 28
15 UIKit 0x2bbc7d28 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 224
16 UIKit 0x2bbc72be -[UINavigationController _startTransition:fromViewController:toViewController:] + 70
17 UIKit 0x2bbc6fee -[UINavigationController _startDeferredTransitionIfNeeded:] + 574
18 UIKit 0x2bbc6d58 -[UINavigationController __viewWillLayoutSubviews] + 40
19 UIKit 0x2bbc6cec -[UILayoutContainerView layoutSubviews] + 180
20 UIKit 0x2bb1b672 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 510
21 QuartzCore 0x2b543cc8 -[CALayer layoutSublayers] + 132
22 QuartzCore 0x2b53f6b0 CA::Layer::layout_if_needed(CA::Transaction*) + 356
23 QuartzCore 0x2b53f538 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12
24 QuartzCore 0x2b53ef1c CA::Context::commit_transaction(CA::Transaction*) + 220
25 QuartzCore 0x2b53ed20 CA::Transaction::commit() + 320
26 UIKit 0x2bd7f390 -[UIApplication _reportMainSceneUpdateFinished:] + 40
27 UIKit 0x2bd80138 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2508
28 UIKit 0x2bd8a544 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 32
29 UIKit 0x2bd7e554 -[UIApplication workspaceDidEndTransaction:] + 128
30 FrontBoardServices 0x2edc10e6 __31-[FBSSerialQueue performAsync:]_block_invoke + 10
31 CoreFoundation 0x286465b2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 10
32 CoreFoundation 0x28645874 __CFRunLoopDoBlocks + 212
33 CoreFoundation 0x286443ae __CFRunLoopRun + 1710
34 CoreFoundation 0x2859261c CFRunLoopRunSpecific + 472
35 CoreFoundation 0x2859242e CFRunLoopRunInMode + 102
36 UIKit 0x2bb8256a -[UIApplication _run] + 554
37 UIKit 0x2bb7d354 UIApplicationMain + 1436
38 My App 0x0004ac3a 0x3a000 + 68666
39 libdyld.dylib 0x362adaac start + 0
I was actually able to symbolicate the crash. It's actually strange and definitely looks like a deadlock:
0 libsystem_kernel.dylib 0x3a64d540 semaphore_wait_trap + 8
1 libdispatch.dylib 0x3a584eee _dispatch_semaphore_wait_slow + 186
2 libxpc.dylib 0x3a6f47b8 xpc_connection_send_message_with_reply_sync + 152
3 Security 0x2fbca310 securityd_message_with_reply_sync + 64
4 Security 0x2fbca48c securityd_send_sync_and_do + 44
5 Security 0x2fbd7452 __SecItemCopyMatching_block_invoke + 166
6 Security 0x2fbd66f6 SecOSStatusWith + 14
7 Security 0x2fbd736e SecItemCopyMatching + 174
8 My App 0x004aadb2 +[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] + 390
I also have other stack traces where another thread is also stuck simultaneously at the same point:
Thread 5 name: Dispatch queue: com.Flurry.Analytics.Session
Thread 5:
0 libsystem_kernel.dylib 0x37c07540 semaphore_wait_trap + 8
1 libdispatch.dylib 0x37b3eeee _dispatch_semaphore_wait_slow + 186
2 libxpc.dylib 0x37cae7b8 xpc_connection_send_message_with_reply_sync + 152
3 Security 0x2d184310 securityd_message_with_reply_sync + 64
4 Security 0x2d18448c securityd_send_sync_and_do + 44
5 Security 0x2d1910fa __SecItemAdd_block_invoke + 158
6 Security 0x2d1906f6 SecOSStatusWith + 14
7 Security 0x2d190ac6 SecItemAdd + 338
8 My App 0x000c57a4 -[FlurryKeychainWrapper setData:forKey:] + 144
9 My App 0x000c569a -[FlurryKeychainWrapper setObject:forKey:] + 66
10 My App 0x000b75a8 -[FlurrySession initialTimestamp] + 880
11 My App 0x000b66a4 -[FlurrySession dataForSessions:] + 872
12 My App 0x000b503c -[FlurrySession sendSessionsToServerIncludingCurrentSession:] + 624
13 libdispatch.dylib 0x37b348c8 _dispatch_call_block_and_release + 8
14 libdispatch.dylib 0x37b3c64c _dispatch_queue_drain + 948
15 libdispatch.dylib 0x37b37098 _dispatch_queue_invoke + 80
16 libdispatch.dylib 0x37b3db9e _dispatch_root_queue_drain + 318
17 libdispatch.dylib 0x37b3ecd2 _dispatch_worker_thread3 + 90
18 libsystem_pthread.dylib 0x37c95e2e _pthread_wqthread + 666
19 libsystem_pthread.dylib 0x37c95b80 start_wqthread + 4