Unknown iOS 11 __psynch_cvwait deadlock crash

Hi, we are writing here because we’ve got a review feedback saying that the review team encountered a crash during the review:


Incident Identifier: 9044E7D0-5E3E-463F-8B33-81E557027516
CrashReporter Key:   f281ac8419366732bcdd8ba3d8e8ac56fbca55a9
Hardware Model:      iPad5,1
Device Model:        J96AP
Process:             **** [5471]
Path:                /private/var/containers/Bundle/Application/1454A3E3-D1B6-4994-83F4-3658759BBFCF/***.app/***
Identifier:          ***
Version:             186 (5.7.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd.development [1]
Coalition:           ru.pepper [1156]

Date/Time:           2018-03-08 03:54:12.8397 -0800
Launch Time:         2018-03-08 03:52:42.1397 -0800
OS Version:          iPhone OS 11.2.5 (15D60)
Baseband Version:    n/a
UDID:                cfa96610b5910c1eea9210890fded4336b5c4ef9
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Termination Description: SPRINGBOARD, scene-update watchdog transgression: ru.pepper exhausted real (wall clock) time allowance of 10.00 seconds |  | ProcessVisibility: Foreground | ProcessState: Running | WatchdogEvent: scene-update | WatchdogVisibility: Foreground | WatchdogCPUStatistics: ( | "Elapsed total CPU time (seconds): 111.820 (user 111.820, system 0.000), 62% CPU", | "Elapsed application CPU time (seconds): 73.111, 40% CPU" | )
Triggered by Thread:  0


Here is the stack trace


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   UIKit                          0x000000018e47bccc -[UIView(UIKitManual) retain] + 28 (UIView_NonARC.m:46)
1   ModelTableViewController       0x0000000100d62300 -[ModelTableViewHandler tableView:willDisplayCell:forRowAtIndexPath:] + 107264 (ModelTableViewHandler.m:928)
2   ModelTableViewController       0x0000000100d5d8ac -[ModelTableViewController tableView:willDisplayCell:forRowAtIndexPath:] + 88236 (ModelTableViewController.m:501)
3   ***                      0x0000000100f39234 __75-[PPRModelTableViewController tableView:willDisplayCell:forRowAtIndexPath:]_block_invoke.498 + 1511988 (PPRModelTableViewController.m:1022)
4   ModelTableViewController       0x0000000100d53810 -[ModelHandler detectSectionBlock:temporaryBlock:normalBlock:] + 47120 (ModelHandler.m:251)
5   ***                      0x0000000100f38fe8 -[PPRModelTableViewController tableView:willDisplayCell:forRowAtIndexPath:] + 1511400 (PPRModelTableViewController.m:1023)
6   UIKit                          0x000000018ddcc878 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 224 (UITableView.m:13425)
7   UIKit                          0x000000018ddcd00c -[UITableView _createPreparedCellForRowAtIndexPath:willDisplay:] + 88 (UITableView.m:13516)
8   UIKit                          0x00000001a3826c8c __56-[UITableViewCellAccessibilityElement realTableViewCell]_block_invoke.14 + 48 (UITableViewCellAccessibilityElement.m:68)
9   AccessibilityUtilities         0x0000000193ce2b80 AXPerformSafeBlock + 60 (AXSafeValue.m:399)
10  UIKit                          0x00000001a3826ad0 -[UITableViewCellAccessibilityElement realTableViewCell] + 652 (UITableViewCellAccessibilityElement.m:67)
11  UIKit                          0x00000001a3826e20 -[UITableViewCellAccessibilityElement tableViewCell] + 100 (UITableViewCellAccessibilityElement.m:103)
12  UIKit                          0x00000001a3827a00 -[UITableViewCellAccessibilityElement accessibilityTraits] + 68 (UITableViewCellAccessibilityElement.m:305)
13  UIAccessibility                0x0000000195884968 __56-[NSObject(AXPrivCategory) _accessibilityTabBarAncestor]_block_invoke + 28 (NSObjectAccessibility.m:1248)
14  UIAccessibility                0x000000019589a544 -[NSObject(AXPrivCategory) _accessibilityFindAncestor:startWithSelf:] + 108 (NSObjectAccessibility.m:7561)
15  UIAccessibility                0x00000001958848c4 -[NSObject(AXPrivCategory) _accessibilityIsInTabBar] + 88 (NSObjectAccessibility.m:1240)
16  UIAccessibility                0x0000000195893ba0 -[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 11624 (NSObjectAccessibility.m:4644)
17  UIAccessibility                0x00000001958bb648 _accessibilityAttributesForObject + 424 (UIAccessibilityAutomation.m:509)
18  UIAccessibility                0x00000001958bb12c -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 2104 (UIAccessibilityAutomation.m:598)
19  UIAccessibility                0x00000001958bcf08 -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 640 (UIAccessibilityAutomation.m:779)
20  UIAccessibility                0x0000000195890268 -[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 8836 (NSObjectAccessibility.m:4304)
21  UIAccessibility                0x000000019586fc80 _copyParameterizedAttributeValueCallback + 224 (UIAccessibilityRuntime.m:752)
22  AXRuntime                      0x0000000193ae6ad0 ___AXXMIGCopyParameterizedAttributeValue_block_invoke + 100 (AccessibilityPriv.m:1128)
23  AXRuntime                      0x0000000193ae6238 _handleNonMainThreadCallback + 60 (AccessibilityPriv.m:363)
24  AXRuntime                      0x0000000193ae6924 _AXXMIGCopyParameterizedAttributeValue + 344 (AccessibilityPriv.m:1127)
25  AXRuntime                      0x0000000193ae1220 _XCopyParameterizedAttributeValue + 380 (AccessibilityClientDefsServer.c:1160)
26  AXRuntime                      0x0000000193af328c mshMIGPerform + 252 (MachServerHelper.c:448)
27  CoreFoundation                 0x000000018447fe00 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56 (CFRunLoop.c:1998)
28  CoreFoundation                 0x000000018447f504 __CFRunLoopDoSource1 + 440 (CFRunLoop.c:2135)
29  CoreFoundation                 0x000000018447cfd8 __CFRunLoopRun + 2196 (CFRunLoop.c:3150)
30  CoreFoundation                 0x000000018439cc58 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
31  GraphicsServices               0x0000000186248f84 GSEventRunModal + 100 (GSEvent.c:2245)
32  UIKit                          0x000000018daf55c4 UIApplicationMain + 236 (UIApplication.m:3956)
33  ***                      0x00000001005670c8 main + 28872 (main.m:20)
34  libdyld.dylib                  0x0000000183ebc56c start + 4

Thread 1 name:  com.apple.uikit.eventfetch-thread
Thread 1:
0   libsystem_kernel.dylib         0x0000000183fcb568 mach_msg_trap + 8
1   libsystem_kernel.dylib         0x0000000183fcb3e0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                 0x000000018447f108 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                 0x000000018447ccd4 __CFRunLoopRun + 1424 (CFRunLoop.c:2969)
4   CoreFoundation                 0x000000018439cc58 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
5   Foundation                     0x0000000184dd1594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 (NSRunLoop.m:367)
6   Foundation                     0x0000000184df09ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 (NSRunLoop.m:411)
7   UIKit                          0x000000018e65f7a8 -[UIEventFetcher threadMain] + 136 (UIEventFetcher.m:437)
8   Foundation                     0x0000000184ed30f4 __NSThread__start__ + 996 (NSThread.m:1181)
9   libsystem_pthread.dylib        0x00000001841002b4 _pthread_body + 308 (pthread.c:740)
10  libsystem_pthread.dylib        0x0000000184100180 _pthread_start + 312 (pthread.c:799)
11  libsystem_pthread.dylib        0x00000001840feb74 thread_start + 4

Thread 2:
0   libsystem_kernel.dylib         0x0000000183fec0f0 __psynch_cvwait + 8
1   libsystem_pthread.dylib        0x0000000184102ce4 _pthread_cond_wait$VARIANT$mp + 640 (pthread_cond.c:579)
2   libc++.1.dylib                 0x00000001836a3ea4 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24 (__threading_support:278)
3   JavaScriptCore                 0x000000018b844f2c void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 96 (condition_variable:202)
4   JavaScriptCore                 0x000000018b844e54 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 172 (condition_variable:211)
5   JavaScriptCore                 0x000000018b8451b8 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 44 (type_traits:4291)
6   libsystem_pthread.dylib        0x00000001841002b4 _pthread_body + 308 (pthread.c:740)
7   libsystem_pthread.dylib        0x0000000184100180 _pthread_start + 312 (pthread.c:799)
8   libsystem_pthread.dylib        0x00000001840feb74 thread_start + 4

Thread 3 name:  com.twitter.crashlytics.ios.MachExceptionServer
Thread 3:
0   libsystem_kernel.dylib         0x0000000183fcb568 mach_msg_trap + 8
1   libsystem_kernel.dylib         0x0000000183fcb3e0 mach_msg + 72 (mach_msg.c:103)
2   ***                      0x000000010056ffa8 CLSMachExceptionServer + 65448 (CLSMachException.c:180)
3   libsystem_pthread.dylib        0x00000001841002b4 _pthread_body + 308 (pthread.c:740)
4   libsystem_pthread.dylib        0x0000000184100180 _pthread_start + 312 (pthread.c:799)
5   libsystem_pthread.dylib        0x00000001840feb74 thread_start + 4

Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib         0x0000000183fcb568 mach_msg_trap + 8
1   libsystem_kernel.dylib         0x0000000183fcb3e0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                 0x000000018447f108 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                 0x000000018447ccd4 __CFRunLoopRun + 1424 (CFRunLoop.c:2969)
4   CoreFoundation                 0x000000018439cc58 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
5   CFNetwork                      0x0000000184c8bb08 -[__CoreSchedulingSetRunnable runForever] + 780 (CoreSchedulingSet.mm:1364)
6   Foundation                     0x0000000184ed30f4 __NSThread__start__ + 996 (NSThread.m:1181)
7   libsystem_pthread.dylib        0x00000001841002b4 _pthread_body + 308 (pthread.c:740)
8   libsystem_pthread.dylib        0x0000000184100180 _pthread_start + 312 (pthread.c:799)
9   libsystem_pthread.dylib        0x00000001840feb74 thread_start + 4

Thread 5 name:  GAIThread
Thread 5:
0   libsystem_kernel.dylib         0x0000000183fcb568 mach_msg_trap + 8
1   libsystem_kernel.dylib         0x0000000183fcb3e0 mach_msg + 72 (mach_msg.c:103)
2   CoreFoundation                 0x000000018447f108 __CFRunLoopServiceMachPort + 196 (CFRunLoop.c:2613)
3   CoreFoundation                 0x000000018447ccd4 __CFRunLoopRun + 1424 (CFRunLoop.c:2969)
4   CoreFoundation                 0x000000018439cc58 CFRunLoopRunSpecific + 436 (CFRunLoop.c:3245)
5   Foundation                     0x0000000184dd1594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 (NSRunLoop.m:367)
6   Foundation                     0x0000000184e2356c -[NSRunLoop(NSRunLoop) run] + 88 (NSRunLoop.m:389)
7   GoogleAnalyticsManager         0x0000000100c96f6c +[GAI threadMain:] + 28524 (GAI.m:241)
8   Foundation                     0x0000000184ed30f4 __NSThread__start__ + 996 (NSThread.m:1181)
9   libsystem_pthread.dylib        0x00000001841002b4 _pthread_body + 308 (pthread.c:740)
10  libsystem_pthread.dylib        0x0000000184100180 _pthread_start + 312 (pthread.c:799)
11  libsystem_pthread.dylib        0x00000001840feb74 thread_start + 4

Thread 6:
0   libsystem_pthread.dylib        0x00000001840feb68 start_wqthread + 0

Thread 7:
0   libsystem_kernel.dylib         0x0000000183fecd80 __workq_kernreturn + 8
1   libsystem_pthread.dylib        0x00000001840ff080 _pthread_wqthread + 1288 (pthread.c:0)
2   libsystem_pthread.dylib        0x00000001840feb6c start_wqthread + 4

Thread 8:
0   libsystem_pthread.dylib        0x00000001840feb68 start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x000000010d28ac00   x1: 0x000000018e824631 x2: 0x0000000000000000   x3: 0x00000001c1664df8
    x4: 0xc000000009000016   x5: 0x0000000000000020 x6: 0x000000010d28ac00   x7: 0x000000000000003d
    x8: 0x000000010d28acc0   x9: 0x000000000000002e x10: 0x0000000000000030  x11: 0x0000000000000000
   x12: 0x0000000101e82310  x13: 0x000005a101145687 x14: 0x00000001028a7400  x15: 0xc000000009000016
   x16: 0x0000000101145680  x17: 0x000000018e47bcb0 x18: 0xfffffff01930d2ac  x19: 0xc000000009000016
   x20: 0x000000010d28ac00  x21: 0x00000001c413b800 x22: 0x00000001028a7400  x23: 0x000000016f89b780
   x24: 0x0000000100d6cf97  x25: 0x00000001b560de88 x26: 0x00000001b560de88  x27: 0x0000000000000000
   x28: 0x00000001c1664dc0   fp: 0x000000016f89b6f0 lr: 0x0000000100d62300
    sp: 0x000000016f89b3b0   pc: 0x000000018e47bccc cpsr: 0x60000000


To be honest, it is very difficult for us to solve this issue.


We have tried to reproduce it using our own devices (several iPads and iPhones on mutliple iOS versions) and everything just worked as expected.


What we saw on the crash report, is that it was fired because of the Main thread (Thread 0) was locked during more than 10 seconds.


What we also saw, is that the last involved statement is a clean and valid UIKit call.


Thread 0:
0   UIKit                          0x000000018e47bccc -[UIView(UIKitManual) retain] + 28 (UIView_NonARC.m:46)


What we finally saw, is that the Thread 2 seems to be in a deadlock situation:

Thread 2:
0   libsystem_kernel.dylib         0x0000000183fec0f0 __psynch_cvwait + 8


We feel like it’s related to a known iOS 11 issue reported on the Apple developer forum ( https://forums.developer.apple.com/thread/83123 ).


Also, it looks like a crash we encounter quite few times (according to crashlytics) on our others app:


# Platform: ios
# Application: *** (de)
# Version: 5.6.0 (182)
# Bundle Identifier: ***
# Issue #: 180
# Issue ID: 592e8ce5be077a4dcc7852b7
# Session ID: f703d976d91647178892b6e08e13ab80_DNE_8_v2
# Date: 2018-03-12T09:10:00Z
# OS Version: 11.2.6 (15D100)
# Device: iPhone 6
# RAM Free: 3%
# Disk Free: 43.9%


#8. Crashed: com.apple.CFNetwork.LoaderQ
0  CFNetwork                      0x181de5310 CFAllocatedReferenceCountedObject::_retainable_hash(void const*) + 26
1  CoreFoundation                 0x18167e160 CFBasicHashFindBucket + 164
2  CoreFoundation                 0x18167e0a0 CFDictionaryGetValue + 224
3  CFNetwork                      0x181e15a4c TubeManager::_onqueue_enqueueRequestForProtocol(MetaConnectionCacheClient*, HTTPRequestMessage const*, MetaConnectionOptions, BaseAwaitingTube*) + 80
4  CFNetwork                      0x181e169b4 TubeManager::_onqueue_reenqueueAwaitingTube(BaseAwaitingTube*) + 112
5  CFNetwork                      0x181e16c14 invocation function for block in TubeManager::_onqueue_newTubeReady(Tube*, CFStreamError) + 28
6  CFNetwork                      0x181f752e4 invocation function for block in QCoreSchedulingSet::performAsync(void () block_pointer) const + 52
7  libdispatch.dylib              0x18113ea54 _dispatch_call_block_and_release + 24
8  libdispatch.dylib              0x18113ea14 _dispatch_client_callout + 16
9  libdispatch.dylib              0x18114896c _dispatch_queue_serial_drain$VARIANT$mp + 528
10 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
11 libdispatch.dylib              0x181148824 _dispatch_queue_serial_drain$VARIANT$mp + 200
12 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
13 libdispatch.dylib              0x181149d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
14 libdispatch.dylib              0x18115203c _dispatch_workloop_worker_thread$VARIANT$mp + 644
15 libsystem_pthread.dylib        0x1813e6f1c _pthread_wqthread + 932
16 libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


--


#0. com.apple.main-thread
0  UIKit                          0x18b763cc8 -[UIView(UIKitManual) retain] + 24
1  QuartzCore                     0x185802970 -[CALayer _display] + 176
2  QuartzCore                     0x1857743d4 CA::Context::commit_transaction(CA::Transaction*) + 520
3  QuartzCore                     0x18579bb40 CA::Transaction::commit() + 540
4  UIKit                          0x18b6e1de4 -[_UIContextBinder updateBindableOrderWithTest:force:] + 436
5  UIKit                          0x18b6e1b04 -[_UIContextBinder createContextsWithTest:creationAction:] + 100
6  UIKit                          0x18b27a7a8 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 792
7  UIKit                          0x18b9ff7c0 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 260
8  UIKit                          0x18b9ff664 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 448
9  UIKit                          0x18b76d2cc __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
10 UIKit                          0x18b9063cc _performActionsWithDelayForTransitionContext + 112
11 UIKit                          0x18b76d17c -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 252
12 UIKit                          0x18b551760 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 364
13 UIKit                          0x18b3f32a8 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 468
14 FrontBoardServices             0x183e82ca4 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 212
15 libdispatch.dylib              0x18113ea14 _dispatch_client_callout + 16
16 libdispatch.dylib              0x181146200 _dispatch_block_invoke_direct$VARIANT$mp + 288
17 FrontBoardServices             0x183eb67f8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
18 FrontBoardServices             0x183eb649c -[FBSSerialQueue _performNext] + 404
19 FrontBoardServices             0x183eb6a38 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
20 CoreFoundation                 0x18176777c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
21 CoreFoundation                 0x1817676fc __CFRunLoopDoSource0 + 88
22 CoreFoundation                 0x181766f84 __CFRunLoopDoSources0 + 204
23 CoreFoundation                 0x181764b5c __CFRunLoopRun + 1048
24 CoreFoundation                 0x181684c58 CFRunLoopRunSpecific + 436
25 GraphicsServices               0x183530f84 GSEventRunModal + 100
26 UIKit                          0x18addd5c4 UIApplicationMain + 236
27 myapp                        0x1001113b4 main (main.m:20)
28 libdyld.dylib                  0x1811a456c start + 4


#1. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1812b3568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1812b33e0 mach_msg + 72
2  CoreFoundation                 0x181767108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x181764cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x181684c58 CFRunLoopRunSpecific + 436
5  Foundation                     0x1820b9594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x1820d89ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7  UIKit                          0x18b9477a8 -[UIEventFetcher threadMain] + 136
8  Foundation                     0x1821bb0f4 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x1813e82b4 _pthread_body + 308
10 libsystem_pthread.dylib        0x1813e8180 _pthread_body + 310
11 libsystem_pthread.dylib        0x1813e6b74 thread_start + 4


#2. Thread
0  libsystem_kernel.dylib         0x1812d40f0 __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1813eace4 _pthread_cond_wait$VARIANT$mp + 640
2  libc++.1.dylib                 0x18098bf34 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 96
3  JavaScriptCore                 0x188b2d168 std::__1::cv_status std::__1::condition_variable::wait_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 124
4  JavaScriptCore                 0x188b2d03c std::__1::cv_status std::__1::condition_variable_any::wait_until<std::__1::unique_lock<bmalloc::Mutex>, std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >(std::__1::unique_lock<bmalloc::Mutex>&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > > const&) + 108
5  JavaScriptCore                 0x188b2cec0 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 280
6  JavaScriptCore                 0x188b2d1b8 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 44
7  libsystem_pthread.dylib        0x1813e82b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x1813e8180 _pthread_body + 310
9  libsystem_pthread.dylib        0x1813e6b74 thread_start + 4


#3. com.twitter.crashlytics.ios.MachExceptionServer
0  myapp                        0x10012e6fc CLSProcessRecordAllThreads (CLSProcess.c:376)
1  myapp                        0x10012e6fc CLSProcessRecordAllThreads (CLSProcess.c:376)
2  myapp                        0x10012e5ac CLSProcessRecordAllThreads (CLSProcess.c:407)
3  myapp                        0x10011dbd8 CLSHandler (CLSHandler.m:26)
4  myapp                        0x100118bf4 CLSMachExceptionServer (CLSMachException.c:446)
5  libsystem_pthread.dylib        0x1813e82b4 _pthread_body + 308
6  libsystem_pthread.dylib        0x1813e8180 _pthread_body + 310
7  libsystem_pthread.dylib        0x1813e6b74 thread_start + 4


#4. GAIThread
0  libsystem_kernel.dylib         0x1812b3568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1812b33e0 mach_msg + 72
2  CoreFoundation                 0x181767108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x181764cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x181684c58 CFRunLoopRunSpecific + 436
5  Foundation                     0x1820b9594 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x18210b56c -[NSRunLoop(NSRunLoop) run] + 88
7  GoogleAnalyticsManager         0x100862f6c +[GAI threadMain:] (GAI.m:241)
8  Foundation                     0x1821bb0f4 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x1813e82b4 _pthread_body + 308
10 libsystem_pthread.dylib        0x1813e8180 _pthread_body + 310
11 libsystem_pthread.dylib        0x1813e6b74 thread_start + 4


#5. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1812b3568 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1812b33e0 mach_msg + 72
2  CoreFoundation                 0x181767108 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x181764cd4 __CFRunLoopRun + 1424
4  CoreFoundation                 0x181684c58 CFRunLoopRunSpecific + 436
5  CFNetwork                      0x181f73b08 -[__CoreSchedulingSetRunnable runForever] + 780
6  Foundation                     0x1821bb0f4 __NSThread__start__ + 996
7  libsystem_pthread.dylib        0x1813e82b4 _pthread_body + 308
8  libsystem_pthread.dylib        0x1813e8180 _pthread_body + 310
9  libsystem_pthread.dylib        0x1813e6b74 thread_start + 4


#6. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#7. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#8. Crashed: com.apple.CFNetwork.LoaderQ
0  CFNetwork                      0x181de5310 CFAllocatedReferenceCountedObject::_retainable_hash(void const*) + 26
1  CoreFoundation                 0x18167e160 CFBasicHashFindBucket + 164
2  CoreFoundation                 0x18167e0a0 CFDictionaryGetValue + 224
3  CFNetwork                      0x181e15a4c TubeManager::_onqueue_enqueueRequestForProtocol(MetaConnectionCacheClient*, HTTPRequestMessage const*, MetaConnectionOptions, BaseAwaitingTube*) + 80
4  CFNetwork                      0x181e169b4 TubeManager::_onqueue_reenqueueAwaitingTube(BaseAwaitingTube*) + 112
5  CFNetwork                      0x181e16c14 invocation function for block in TubeManager::_onqueue_newTubeReady(Tube*, CFStreamError) + 28
6  CFNetwork                      0x181f752e4 invocation function for block in QCoreSchedulingSet::performAsync(void () block_pointer) const + 52
7  libdispatch.dylib              0x18113ea54 _dispatch_call_block_and_release + 24
8  libdispatch.dylib              0x18113ea14 _dispatch_client_callout + 16
9  libdispatch.dylib              0x18114896c _dispatch_queue_serial_drain$VARIANT$mp + 528
10 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
11 libdispatch.dylib              0x181148824 _dispatch_queue_serial_drain$VARIANT$mp + 200
12 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
13 libdispatch.dylib              0x181149d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
14 libdispatch.dylib              0x18115203c _dispatch_workloop_worker_thread$VARIANT$mp + 644
15 libsystem_pthread.dylib        0x1813e6f1c _pthread_wqthread + 932
16 libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#9. com.apple.CoreLocation.ConnectionClient.0x105eef3c0.events
0  libsystem_kernel.dylib         0x1812b35bc semaphore_timedwait_trap + 8
1  libdispatch.dylib              0x181141000 _dispatch_sema4_timedwait$VARIANT$mp + 84
2  libdispatch.dylib              0x181141870 _dispatch_semaphore_wait_slow + 72
3  CoreLocation                   0x187da5554 (null) + 652
4  CoreLocation                   0x187dab3e8 (null) + 2704
5  CoreLocation                   0x187e02f2c (null) + 77356
6  CoreLocation                   0x187dff3a4 (null) + 62116
7  CoreLocation                   0x187e009b0 (null) + 67760
8  libxpc.dylib                   0x181422634 _xpc_connection_call_event_handler + 68
9  libxpc.dylib                   0x181426678 do_mach_notify_port_destroyed + 160
10 libxpc.dylib                   0x1814265a4 _Xmach_notify_port_destroyed + 80
11 libxpc.dylib                   0x181426528 notify_server + 92
12 libxpc.dylib                   0x18142c968 _xpc_connection_pass2mig + 164
13 libxpc.dylib                   0x181420028 _xpc_connection_mach_event + 1080
14 libdispatch.dylib              0x18113eae4 _dispatch_client_callout4 + 16
15 libdispatch.dylib              0x181155454 _dispatch_mach_msg_invoke$VARIANT$mp + 356
16 libdispatch.dylib              0x181148824 _dispatch_queue_serial_drain$VARIANT$mp + 200
17 libdispatch.dylib              0x1811560d0 _dispatch_mach_invoke$VARIANT$mp + 952
18 libdispatch.dylib              0x181148824 _dispatch_queue_serial_drain$VARIANT$mp + 200
19 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
20 libdispatch.dylib              0x181148824 _dispatch_queue_serial_drain$VARIANT$mp + 200
21 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
22 libdispatch.dylib              0x181149d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
23 libdispatch.dylib              0x18115203c _dispatch_workloop_worker_thread$VARIANT$mp + 644
24 libsystem_pthread.dylib        0x1813e6f1c _pthread_wqthread + 932
25 libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#10. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#11. CTTelephonyNetworkInfo
0  libsystem_kernel.dylib         0x1812d40f0 __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x1813eace4 _pthread_cond_wait$VARIANT$mp + 640
2  Foundation                     0x1821935b0 -[__NSOperationInternal _waitUntilFinished:] + 776
3  Foundation                     0x1820b5e78 -[__NSObserver _doit:] + 236
4  CoreFoundation                 0x18175113c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
5  CoreFoundation                 0x1817506dc _CFXRegistrationPost + 420
6  CoreFoundation                 0x181750440 ___CFXNotificationPost_block_invoke + 60
7  CoreFoundation                 0x1817cde24 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
8  CoreFoundation                 0x181686d60 _CFXNotificationPost + 380
9  Foundation                     0x1820b3348 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
10 CoreTelephony                  0x18428e3dc -[CTTelephonyNetworkInfo queryDataMode] + 408
11 CoreTelephony                  0x18428db70 -[CTTelephonyNetworkInfo handleNotificationFromConnection:ofType:withInfo:] + 420
12 CoreTelephony                  0x18428cf54 _ServerConnectionCallback(__CTServerConnection*, __CFString const*, __CFDictionary const*, void*) + 136
13 CoreTelephony                  0x1842a6dd4 ___ZNK13CTServerState21sendNotification_syncE7CTEventPK10__CFStringPK14__CFDictionary_block_invoke.12 + 32
14 libdispatch.dylib              0x18113ea54 _dispatch_call_block_and_release + 24
15 libdispatch.dylib              0x18113ea14 _dispatch_client_callout + 16
16 libdispatch.dylib              0x18114896c _dispatch_queue_serial_drain$VARIANT$mp + 528
17 libdispatch.dylib              0x1811492fc _dispatch_queue_invoke$VARIANT$mp + 340
18 libdispatch.dylib              0x181149d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
19 libdispatch.dylib              0x18115203c _dispatch_workloop_worker_thread$VARIANT$mp + 644
20 libsystem_pthread.dylib        0x1813e6f1c _pthread_wqthread + 932
21 libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#12. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#13. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#14. Thread
0  libsystem_pthread.dylib        0x1813e6b68 start_wqthread + 122


#15. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#16. Thread
0  libsystem_pthread.dylib        0x1813e6b68 start_wqthread + 122


#17. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#18. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#19. Thread
0  libsystem_pthread.dylib        0x1813e6b68 start_wqthread + 122


#20. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#21. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


#22. Thread
0  libsystem_kernel.dylib         0x1812d4d80 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x1813e6eec _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x1813e6b6c start_wqthread + 4


We are using NSURLSession with AFNetworking 3.0.4 for all API calls.


Many thanks in advance.

Replies

What we finally saw, is that the Thread 2 seems to be in a deadlock situation:

Thread 2 is not the cause of this crash.

__psynch_cvwait
is part of the pthread condition variable implementation, and this particular thread is the JavaScriptCore memory manager (hence frames 4 and 5) waiting for work to do. Given that main thread isn’t doing anything JavaScript-ish, it’s unlikely to be deadlocked with the JavaScript memory management thread.

We feel like it’s related to a known iOS 11 issue reported on the Apple developer forum …

I’m not sure why you think that’s the case. Your first crash report is the watchdog killling your app for being unresponsive and you second crash report is a memory access exception within CFNetwork.

We feel like it’s related to a known iOS 11 issue reported on the Apple developer forum …

That’s correct, for the second crash only. I’m going to ignore that second crash in this context because it’s clearly a different thing and I’ve already given me input on that in the other thread you mentioned.

Which brings us back to your first crash. I have some thoughts on that but I’ll pass them on via a different channel.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"