Deadlock iOS 13. BKSProcessAssertion

I have reports from users that my app gets stuck. I was able to reproduce some weird deadlocks when I use camera or try to open files for preview. Can someone give me a hint what's going on, I can't find anything in google. I believe this was introduced in iOS 13, there were no reports about deadlocks before that.


Here is the stack when a photo was taken and the UIImagePickerController disappeared from the screen:


Thread 1 Queue : com.apple.main-thread (serial)

#0 0x00000001ae31b8f0 in __ulock_wait ()

#1 0x00000001ae235040 in _os_unfair_lock_lock_slow ()

#2 0x00000001b2d15298 in -[BKSAssertion _invalidateSynchronously:] ()

#3 0x00000001b2d19fac in -[BKSProcessAssertion invalidate] ()

#4 0x00000001b2627518 in __31-[UIApplication _endFenceTask:]_block_invoke ()

#5 0x00000001053f5e1c in _dispatch_call_block_and_release ()

#6 0x00000001053f727c in _dispatch_client_callout ()

#7 0x000000010540532c in _dispatch_main_queue_callback_4CF ()

#8 0x00000001ae4abcc8 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()

#9 0x00000001ae4a6a24 in __CFRunLoopRun ()

#10 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#11 0x00000001b8736534 in GSEventRunModal ()

#12 0x00000001b2631580 in UIApplicationMain ()

#13 0x00000001021b4f1c in main at /Users/dev/MyApp/App/S2RAppDelegate.swift:16

#14 0x00000001ae324e18 in start ()

Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)

#0 0x000000010542abf0 in _dispatch_introspection_queue_item_enqueue_hook ()

#1 0x00000001053fbae8 in dispatch_async ()

#2 0x00000001b2627464 in -[UIApplication _endFenceTask:] ()

#3 0x00000001b262a088 in -[UIApplication _synchronizeSystemAnimationFencesWithSpinCleanUpBlock:] ()

#4 0x00000001b2675cec in __realPreCommitHandler_block_invoke_3 ()

#5 0x00000001b5051c0c in CA::Context::commit_transaction(CA::Transaction*, double) ()

#6 0x00000001b507c910 in CA::Transaction::commit() ()

#7 0x00000001b265b9c0 in _afterCACommitHandler ()

#8 0x00000001ae4ab524 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()

#9 0x00000001ae4a61c4 in __CFRunLoopDoObservers ()

#10 0x00000001ae4a6774 in __CFRunLoopRun ()

#11 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#12 0x00000001b8736534 in GSEventRunModal ()

#13 0x00000001b2631580 in UIApplicationMain ()

#14 0x00000001021b4f1c in main at /Users/dev/MyApp/App/S2RAppDelegate.swift:16

#15 0x00000001ae324e18 in start ()


com.apple.uikit.eventfetch-thread (6)#0 0x00000001ae2f8c04 in mach_msg_trap ()

#1 0x00000001ae2f8020 in mach_msg ()

#2 0x00000001ae4ab964 in __CFRunLoopServiceMachPort ()

#3 0x00000001ae4a67fc in __CFRunLoopRun ()

#4 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#5 0x00000001ae7eb340 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()

#6 0x00000001ae7eb218 in -[NSRunLoop(NSRunLoop) runUntilDate:] ()

#7 0x00000001b26cce9c in -[UIEventFetcher threadMain] ()

#8 0x00000001ae7e9fa4 in -[NSThread main] ()

#9 0x00000001ae925a74 in __NSThread__start__ ()

#10 0x00000001ae239840 in _pthread_start ()


com.apple.NSURLConnectionLoader (13)#0 0x00000001ae2f8c04 in mach_msg_trap ()

#1 0x00000001ae2f8020 in mach_msg ()

#2 0x00000001ae4ab964 in __CFRunLoopServiceMachPort ()

#3 0x00000001ae4a67fc in __CFRunLoopRun ()

#4 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#5 0x00000001b17ab568 in ___lldb_unnamed_symbol3$$CFNetwork ()

#6 0x00000001ae7e9fa4 in -[NSThread main] ()

#7 0x00000001ae925a74 in __NSThread__start__ ()

#8 0x00000001ae239840 in _pthread_start ()


com.apple.CoreMotion.MotionThread (14)#0 0x00000001ae2f8c04 in mach_msg_trap ()

#1 0x00000001ae2f8020 in mach_msg ()

#2 0x00000001ae4ab964 in __CFRunLoopServiceMachPort ()

#3 0x00000001ae4a67fc in __CFRunLoopRun ()

#4 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#5 0x00000001ae4a6c70 in CFRunLoopRun ()

#6 0x00000001bb30d704 in ___lldb_unnamed_symbol4991$$CoreMotion ()

#7 0x00000001ae239840 in _pthread_start ()


AVAudioSession Notify Thread (20)#0 0x00000001ae2f8c04 in mach_msg_trap ()

#1 0x00000001ae2f8020 in mach_msg ()

#2 0x00000001ae4ab964 in __CFRunLoopServiceMachPort ()

#3 0x00000001ae4a67fc in __CFRunLoopRun ()

#4 0x00000001ae4a5f40 in CFRunLoopRunSpecific ()

#5 0x00000001bb44df70 in GenericRunLoopThread::Entry(void*) ()

#6 0x00000001bb49f1fc in CAPThread::Entry(CAPThread*) ()

#7 0x00000001ae239840 in _pthread_start ()


Thread 42 Queue : com.apple.runningboardservices.background-workloop (serial)

#0 0x00000001ae31b8f0 in __ulock_wait ()

#1 0x00000001ae235040 in _os_unfair_lock_lock_slow ()

#2 0x00000001ae25d048 in objc_sync_enter ()

#3 0x00000001b10cb504 in -[RBSAssertionIdentifier description] ()

#4 0x00000001ae906ca0 in _NS_os_log_callback ()

#5 0x00000001ae10a144 in _os_log_fmt_flatten_NSCF ()

#6 0x00000001ae109954 in _os_log_fmt_flatten_object ()

#7 0x00000001ae116790 in _os_log_impl_flatten_and_send ()

#8 0x00000001ae116028 in _os_log ()

#9 0x00000001ae11c3f0 in _os_log_debug_impl ()

#10 0x00000001b10efd0c in -[RBSConnection acquireAssertion:error:].cold.2 ()

#11 0x00000001b10d4618 in -[RBSConnection acquireAssertion:error:] ()

#12 0x00000001b10d0e7c in -[RBSAssertion acquireWithError:] ()

#13 0x00000001b2d15028 in -[BKSAssertion acquire] ()

#14 0x00000001b2d19e7c in -[BKSProcessAssertion acquire] ()

#15 0x00000001053f5e1c in _dispatch_call_block_and_release ()

#16 0x00000001053f727c in _dispatch_client_callout ()

#17 0x0000000105400ab4 in _dispatch_workloop_invoke2 ()

#18 0x00000001054002a0 in _dispatch_workloop_invoke ()

#19 0x000000010540a4dc in _dispatch_workloop_worker_thread ()

#20 0x00000001ae23b6d0 in _pthread_wqthread ()


Thread 43#0 0x00000001ae31bab4 in __workq_kernreturn ()


Thread 46#0 0x00000001ae31bab4 in __workq_kernreturn ()


Thread 48#0 0x00000001ae31bab4 in __workq_kernreturn ()


Thread 49#0 0x0000000000000000 in 0x00000000 ()


Thread 50#0 0x0000000000000000 in 0x00000000 ()

Replies

Here is the stack when …

How do you generate this stack? From within Xcode? Or is this an excerpt from a crash report?

Share and Enjoy

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

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

From within XCode. The app stops reacting to my touches when I debug, I press pause.