SRGSSR / srgmediaplayer-apple

An advanced media player library, simple and reliable
MIT License
159 stars 33 forks source link

Route detector deadlock? #95

Closed defagos closed 4 years ago

defagos commented 4 years ago

We were reported a rare SRGRouteDetector deadlock when registering for notifications. I could reproduce it, here is the stack trace for all threads:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00000001bc6d73d0 libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001d76e90e8 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 196
    frame #2: 0x0000000190ecbd4c CoreFoundation`CFXNotificationRegistrarAdd + 328
    frame #3: 0x0000000190df5ee4 CoreFoundation`_CFXNotificationRegisterObserver + 240
    frame #4: 0x000000019208afcc Foundation`-[NSNotificationCenter addObserver:selector:name:object:] + 420
    frame #5: 0x00000001024d9090 SRGLetterbox-demo`-[SRGRouteDetector init](self=0x00000002839bdce0, _cmd="init") at SRGRouteDetector~ios.m:66:9
  * frame #6: 0x00000001024d8e64 SRGLetterbox-demo`+[SRGRouteDetector initialize](self=SRGRouteDetector, _cmd="initialize") at SRGRouteDetector~ios.m:43:27
    frame #7: 0x00000001a4f0d508 libobjc.A.dylib`CALLING_SOME_+initialize_METHOD + 24
    frame #8: 0x00000001a4f13a88 libobjc.A.dylib`initializeNonMetaClass + 716
    frame #9: 0x00000001a4f15060 libobjc.A.dylib`initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) + 280
    frame #10: 0x00000001a4f23a38 libobjc.A.dylib`lookUpImpOrForward + 944
    frame #11: 0x00000001a4f0dda4 libobjc.A.dylib`_objc_msgSend_uncached + 68
    frame #12: 0x00000001024a8520 SRGLetterbox-demo`__61-[SRGAirPlayButton updateAppearanceForMediaPlayerController:]_block_invoke(.block_descriptor=0x0000000283756c10) at SRGAirPlayButton~ios.m:262:37
    frame #13: 0x00000001024a8450 SRGLetterbox-demo`-[SRGAirPlayButton updateAppearanceForMediaPlayerController:](self=0x0000000103e15210, _cmd="updateAppearanceForMediaPlayerController:", mediaPlayerController=0x0000000000000000) at SRGAirPlayButton~ios.m:285:62
    frame #14: 0x00000001024a7e00 SRGLetterbox-demo`-[SRGAirPlayButton updateAppearance](self=0x0000000103e15210, _cmd="updateAppearance") at SRGAirPlayButton~ios.m:222:5
    frame #15: 0x00000001024a75b0 SRGLetterbox-demo`-[SRGAirPlayButton setAudioImage:](self=0x0000000103e15210, _cmd="setAudioImage:", audioImage=0x0000000280be9560) at SRGAirPlayButton~ios.m:139:5
    frame #16: 0x0000000102449654 SRGLetterbox-demo`-[SRGControlsView layoutAirPlayButtonInStackView:](self=0x0000000105d10f30, _cmd="layoutAirPlayButtonInStackView:", stackView=0x0000000105d11770) at SRGControlsView~ios.m:173:19
    frame #17: 0x0000000102449194 SRGLetterbox-demo`-[SRGControlsView layoutBottomControlsInView:](self=0x0000000105d10f30, _cmd="layoutBottomControlsInView:", view=0x0000000105d11370) at SRGControlsView~ios.m:146:5
    frame #18: 0x0000000102448314 SRGLetterbox-demo`-[SRGControlsView layoutContentView](self=0x0000000105d10f30, _cmd="layoutContentView") at SRGControlsView~ios.m:89:5
    frame #19: 0x000000010245d854 SRGLetterbox-demo`commonInit(self=0x0000000105d10f30) at SRGLetterboxBaseView.m:167:5
    frame #20: 0x000000010245d78c SRGLetterbox-demo`-[SRGLetterboxBaseView initWithFrame:](self=0x0000000105d10f30, _cmd="initWithFrame:", frame=(origin = (x = 0, y = 0), size = (width = 0, height = 0))) at SRGLetterboxBaseView.m:28:9
    frame #21: 0x0000000102484064 SRGLetterbox-demo`-[SRGLetterboxView layoutControlsViewInView:](self=0x0000000105d0cbc0, _cmd="layoutControlsViewInView:", view=0x0000000105d0ce00) at SRGLetterboxView~ios.m:208:37
    frame #22: 0x0000000102482d44 SRGLetterbox-demo`-[SRGLetterboxView layoutContentView](self=0x0000000105d0cbc0, _cmd="layoutContentView") at SRGLetterboxView~ios.m:121:5
    frame #23: 0x000000010245d854 SRGLetterbox-demo`commonInit(self=0x0000000105d0cbc0) at SRGLetterboxBaseView.m:167:5
    frame #24: 0x000000010245d908 SRGLetterbox-demo`-[SRGLetterboxBaseView initWithCoder:](self=0x0000000105d0cbc0, _cmd="initWithCoder:", aDecoder=0x000000010b00d600) at SRGLetterboxBaseView.m:36:9
    frame #25: 0x00000001933d4c64 UIKitCore`-[UIClassSwapper initWithCoder:] + 2096
    frame #26: 0x0000000199e5c190 UIFoundation`UINibDecoderDecodeObjectForValue + 700
    frame #27: 0x0000000199e5c3a8 UIFoundation`UINibDecoderDecodeObjectForValue + 1236
    frame #28: 0x0000000199de92c4 UIFoundation`-[UINibDecoder decodeObjectForKey:] + 312
    frame #29: 0x0000000193caf16c UIKitCore`-[UIView initWithCoder:] + 988
    frame #30: 0x0000000199e5c190 UIFoundation`UINibDecoderDecodeObjectForValue + 700
    frame #31: 0x0000000199de92c4 UIFoundation`-[UINibDecoder decodeObjectForKey:] + 312
    frame #32: 0x00000001933d8fe0 UIKitCore`-[UIRuntimeConnection initWithCoder:] + 132
    frame #33: 0x00000001933da568 UIKitCore`-[UIRuntimeOutletCollectionConnection initWithCoder:] + 72
    frame #34: 0x0000000199e5c190 UIFoundation`UINibDecoderDecodeObjectForValue + 700
    frame #35: 0x0000000199e5c3a8 UIFoundation`UINibDecoderDecodeObjectForValue + 1236
    frame #36: 0x0000000199de92c4 UIFoundation`-[UINibDecoder decodeObjectForKey:] + 312
    frame #37: 0x00000001933d3e48 UIKitCore`-[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 492
    frame #38: 0x00000001933d6860 UIKitCore`-[UINib instantiateWithOwner:options:] + 1068
    frame #39: 0x00000001930b7770 UIKitCore`-[UIViewController loadView] + 592
    frame #40: 0x00000001930b7b20 UIKitCore`-[UIViewController loadViewIfRequired] + 200
    frame #41: 0x00000001930b81d8 UIKitCore`-[UIViewController view] + 32
    frame #42: 0x00000001930ceafc UIKitCore`-[UIViewController _setPresentationController:] + 112
    frame #43: 0x00000001930c6f2c UIKitCore`-[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1428
    frame #44: 0x00000001930ca50c UIKitCore`-[UIViewController _presentViewController:withAnimationController:completion:] + 4368
    frame #45: 0x00000001930cb430 UIKitCore`__63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 108
    frame #46: 0x00000001930cb784 UIKitCore`-[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 536
    frame #47: 0x00000001930cb37c UIKitCore`-[UIViewController _presentViewController:animated:completion:] + 216
    frame #48: 0x00000001930cb860 UIKitCore`-[UIViewController presentViewController:animated:completion:] + 188
    frame #49: 0x000000010241890c SRGLetterbox-demo`__70-[UIViewController(.block_descriptor=0x0000000282c9f7c0) openPlayerWithURN:media:serviceURL:]_block_invoke at UIViewController+LetterboxDemo.m:135:9
    frame #50: 0x0000000102418a94 SRGLetterbox-demo`__70-[UIViewController(.block_descriptor=0x000000016d9f1f48, shouldStartPlayback=YES, routeSelection=AVAudioSessionRouteSelectionLocal) openPlayerWithURN:media:serviceURL:]_block_invoke.18 at UIViewController+LetterboxDemo.m:143:17
    frame #51: 0x00000001a6334194 AVKit`-[AVExternalPlaybackController willBeginPlaybackFromAppWithBundleID:completionHandler:] + 2080
    frame #52: 0x00000001a62d7ff8 AVKit`-[AVAudioSession(AVPlaybackRouteSelecting_Private) prepareRouteSelectionForPlaybackFromBundleID:withCompletionHandler:] + 196
    frame #53: 0x000000010241879c SRGLetterbox-demo`-[UIViewController(self=0x0000000105d05af0, _cmd="openPlayerWithURN:media:serviceURL:", URN=@"urn:swi:video:41981254", media=0x0000000000000000, serviceURL=@"https://il.srgssr.ch/integrationlayer") openPlayerWithURN:media:serviceURL:] at UIViewController+LetterboxDemo.m:141:9
    frame #54: 0x00000001024183f0 SRGLetterbox-demo`-[UIViewController(self=0x0000000105d05af0, _cmd="openPlayerWithURN:serviceURL:", URN=@"urn:swi:video:41981254", serviceURL=0x0000000000000000) openPlayerWithURN:serviceURL:] at UIViewController+LetterboxDemo.m:59:5
    frame #55: 0x0000000102416700 SRGLetterbox-demo`-[MediasViewController tableView:didSelectRowAtIndexPath:](self=0x0000000105d05af0, _cmd="tableView:didSelectRowAtIndexPath:", tableView=0x0000000105014400, indexPath=0x85fbd0ae081e05f5) at MediasViewController.m:120:9
    frame #56: 0x00000001939b80d0 UIKitCore`-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:] + 1064
    frame #57: 0x00000001939b7c8c UIKitCore`-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 112
    frame #58: 0x00000001939b8438 UIKitCore`-[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 272
    frame #59: 0x0000000193c7d544 UIKitCore`-[_UIAfterCACommitBlock run] + 72
    frame #60: 0x00000001937c2400 UIKitCore`_runAfterCACommitDeferredBlocks + 300
    frame #61: 0x00000001937b11bc UIKitCore`_cleanUpAfterCAFlushAndRunDeferredBlocks + 204
    frame #62: 0x00000001937e4648 UIKitCore`_afterCACommitHandler + 80
    frame #63: 0x0000000190e14444 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
    frame #64: 0x0000000190e0e858 CoreFoundation`__CFRunLoopDoObservers + 576
    frame #65: 0x0000000190e0ee08 CoreFoundation`__CFRunLoopRun + 1056
    frame #66: 0x0000000190e0e4bc CoreFoundation`CFRunLoopRunSpecific + 600
    frame #67: 0x00000001a7893820 GraphicsServices`GSEventRunModal + 164
    frame #68: 0x00000001937b2734 UIKitCore`-[UIApplication _run] + 1072
    frame #69: 0x00000001937b7e10 UIKitCore`UIApplicationMain + 168
    frame #70: 0x0000000102426000 SRGLetterbox-demo`main(argc=1, argv=0x000000016d9f36e0) at main.m:14:16
    frame #71: 0x0000000190ad5e60 libdyld.dylib`start + 4
  thread #3, name = 'gputools.smt_poll.0x2839c8080'
    frame #0: 0x00000001bc6d6d30 libsystem_kernel.dylib`__semwait_signal + 8
    frame #1: 0x0000000199f977bc libsystem_c.dylib`nanosleep + 216
    frame #2: 0x0000000199f9768c libsystem_c.dylib`usleep + 68
    frame #3: 0x0000000103b6574c GPUToolsCore`smt_poll_thread_entry(void*) + 148
    frame #4: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #4, name = 'gputools.smt_poll.0x2839f4080'
    frame #0: 0x00000001bc6d6d30 libsystem_kernel.dylib`__semwait_signal + 8
    frame #1: 0x0000000199f977bc libsystem_c.dylib`nanosleep + 216
    frame #2: 0x0000000199f9768c libsystem_c.dylib`usleep + 68
    frame #3: 0x0000000102fc21e0 libMTLCapture.dylib`___lldb_unnamed_symbol2216$$libMTLCapture.dylib + 108
    frame #4: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #7, name = 'com.apple.uikit.eventfetch-thread'
    frame #0: 0x00000001bc6b2dd0 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001bc6b2184 libsystem_kernel.dylib`mach_msg + 76
    frame #2: 0x0000000190e14cf8 CoreFoundation`__CFRunLoopServiceMachPort + 380
    frame #3: 0x0000000190e0eea8 CoreFoundation`__CFRunLoopRun + 1216
    frame #4: 0x0000000190e0e4bc CoreFoundation`CFRunLoopRunSpecific + 600
    frame #5: 0x000000019208be30 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 232
    frame #6: 0x000000019208bd08 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 92
    frame #7: 0x0000000193862e94 UIKitCore`-[UIEventFetcher threadMain] + 516
    frame #8: 0x00000001921f60f0 Foundation`__NSThread__start__ + 864
    frame #9: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #8, queue = 'com.apple.coremedia.systemcontroller.xpc.notifications'
    frame #0: 0x00000001bc6d73d0 libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001d76e90e8 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 196
    frame #2: 0x0000000190ecaba8 CoreFoundation`CFXNotificationRegistrarFind + 288
    frame #3: 0x0000000190df663c CoreFoundation`_CFXNotificationPost + 604
    frame #4: 0x0000000190df729c CoreFoundation`CFNotificationCenterPostNotificationWithOptions + 136
    frame #5: 0x00000001999eee8c CoreMedia`CMNotificationCenterPostNotification + 128
    frame #6: 0x0000000199aa701c CoreMedia`__figXPC_HandleNotificationMessage_block_invoke + 192
    frame #7: 0x00000001039bbb68 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #8: 0x00000001039bd5f0 libdispatch.dylib`_dispatch_client_callout + 20
    frame #9: 0x00000001039c4fa8 libdispatch.dylib`_dispatch_lane_serial_drain + 736
    frame #10: 0x00000001039c5cb4 libdispatch.dylib`_dispatch_lane_invoke + 448
    frame #11: 0x00000001039d1e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
    frame #12: 0x00000001d76f0908 libsystem_pthread.dylib`_pthread_wqthread + 276
  thread #10, queue = 'com.apple.coremedia.routediscoverer.xpc.notifications'
    frame #0: 0x00000001bc6d675c libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x00000001d76f2550 libsystem_pthread.dylib`_pthread_cond_wait + 1192
    frame #2: 0x00000001a4f12b88 libobjc.A.dylib`WAITING_FOR_ANOTHER_THREAD_TO_FINISH_CALLING_+initialize + 120
    frame #3: 0x00000001a4f13ad8 libobjc.A.dylib`initializeNonMetaClass + 796
    frame #4: 0x00000001a4f15060 libobjc.A.dylib`initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) + 280
    frame #5: 0x00000001a4f30c94 libobjc.A.dylib`objc_loadWeakRetained + 268
    frame #6: 0x0000000190ecb08c CoreFoundation`_CFXNotificationRegistrarFindObservers + 308
    frame #7: 0x0000000190ecac30 CoreFoundation`CFXNotificationRegistrarFind + 424
    frame #8: 0x0000000190df663c CoreFoundation`_CFXNotificationPost + 604
    frame #9: 0x000000019880ce48 AVFCore`-[AVRouteDetector _updateMultipleRoutesDetected] + 268
    frame #10: 0x00000001920aeabc Foundation`-[__NSObserver _doit:] + 348
    frame #11: 0x0000000190df7764 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
    frame #12: 0x0000000190df7718 CoreFoundation`___CFXRegistrationPost_block_invoke + 52
    frame #13: 0x0000000190df6cd4 CoreFoundation`_CFXRegistrationPost + 440
    frame #14: 0x0000000190df66a0 CoreFoundation`_CFXNotificationPost + 704
    frame #15: 0x00000001920aeabc Foundation`-[__NSObserver _doit:] + 348
    frame #16: 0x0000000190df7764 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
    frame #17: 0x0000000190df7718 CoreFoundation`___CFXRegistrationPost_block_invoke + 52
    frame #18: 0x0000000190df6cd4 CoreFoundation`_CFXRegistrationPost + 440
    frame #19: 0x0000000190df66a0 CoreFoundation`_CFXNotificationPost + 704
    frame #20: 0x0000000190df729c CoreFoundation`CFNotificationCenterPostNotificationWithOptions + 136
    frame #21: 0x00000001999eee8c CoreMedia`CMNotificationCenterPostNotification + 128
    frame #22: 0x0000000199aa701c CoreMedia`__figXPC_HandleNotificationMessage_block_invoke + 192
    frame #23: 0x00000001039bbb68 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #24: 0x00000001039bd5f0 libdispatch.dylib`_dispatch_client_callout + 20
    frame #25: 0x00000001039c4fa8 libdispatch.dylib`_dispatch_lane_serial_drain + 736
    frame #26: 0x00000001039c5cb4 libdispatch.dylib`_dispatch_lane_invoke + 448
    frame #27: 0x00000001039d1e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
    frame #28: 0x00000001d76f0908 libsystem_pthread.dylib`_pthread_wqthread + 276
  thread #11, name = 'AVAudioSession Notify Thread'
    frame #0: 0x00000001bc6b2dd0 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001bc6b2184 libsystem_kernel.dylib`mach_msg + 76
    frame #2: 0x0000000190e14cf8 CoreFoundation`__CFRunLoopServiceMachPort + 380
    frame #3: 0x0000000190e0eea8 CoreFoundation`__CFRunLoopRun + 1216
    frame #4: 0x0000000190e0e4bc CoreFoundation`CFRunLoopRunSpecific + 600
    frame #5: 0x00000001986b02ac AudioSession`GenericRunLoopThread::Entry(void*) + 164
    frame #6: 0x00000001986b2390 AudioSession`CAPThread::Entry(CAPThread*) + 92
    frame #7: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #12, name = 'ComScore-Thread'
    frame #0: 0x00000001bc6d675c libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x00000001d76f257c libsystem_pthread.dylib`_pthread_cond_wait + 1236
    frame #2: 0x000000010310472c ComScore`ComScore::WaitableEvent::wait(int) const + 188
    frame #3: 0x00000001030c341c ComScore`ComScore::ContextTasksThread<ComScore::Core>::run() + 224
    frame #4: 0x0000000103104ff8 ComScore`ComScore::Thread::threadEntryPoint() + 104
    frame #5: 0x0000000103108db0 ComScore`threadEntryProc + 32
    frame #6: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #13, name = 'ComScore-NetworkThread'
    frame #0: 0x00000001bc6d675c libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x00000001d76f257c libsystem_pthread.dylib`_pthread_cond_wait + 1236
    frame #2: 0x000000010310472c ComScore`ComScore::WaitableEvent::wait(int) const + 188
    frame #3: 0x00000001030c341c ComScore`ComScore::ContextTasksThread<ComScore::Core>::run() + 224
    frame #4: 0x0000000103104ff8 ComScore`ComScore::Thread::threadEntryPoint() + 104
    frame #5: 0x0000000103108db0 ComScore`threadEntryProc + 32
    frame #6: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #14, queue = 'com.apple.avfoundation.avcmnotificationdispatcher.ivars'
    frame #0: 0x00000001bc6d73d0 libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001d76e90e8 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 196
    frame #2: 0x0000000190ecbd4c CoreFoundation`CFXNotificationRegistrarAdd + 328
    frame #3: 0x0000000190df5ee4 CoreFoundation`_CFXNotificationRegisterObserver + 240
    frame #4: 0x00000001920932cc Foundation`-[NSNotificationCenter addObserverForName:object:queue:usingBlock:] + 256
    frame #5: 0x00000001987a9b40 AVFCore`__86-[AVCMNotificationDispatcher addListenerWithWeakReference:callback:name:object:flags:]_block_invoke + 156
    frame #6: 0x00000001039bd5f0 libdispatch.dylib`_dispatch_client_callout + 20
    frame #7: 0x00000001039cd7f8 libdispatch.dylib`_dispatch_lane_barrier_sync_invoke_and_complete + 176
    frame #8: 0x00000001987a9a98 AVFCore`-[AVCMNotificationDispatcher addListenerWithWeakReference:callback:name:object:flags:] + 112
    frame #9: 0x0000000198774318 AVFCore`-[AVFigRouteDescriptorOutputDeviceImpl initWithRouteDescriptor:routeDiscoverer:volumeController:routingContextFactory:useRouteConfigUpdatedNotification:] + 332
    frame #10: 0x0000000198774120 AVFCore`+[AVOutputDevice(FigRouteDescriptor) outputDeviceWithRouteDescriptor:syncController:] + 272
    frame #11: 0x00000001987f4624 AVFCore`-[AVFigRouteDescriptorFigRoutingContextOutputDeviceTranslator outputDevicesFromRoutingContext:] + 260
    frame #12: 0x00000001a63385b0 AVKit`-[AVRoutePickerView _isAirPlayActive] + 152
    frame #13: 0x00000001a63388b8 AVKit`__41-[AVRoutePickerView _updateAirPlayActive]_block_invoke + 52
    frame #14: 0x00000001039bbb68 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #15: 0x00000001039bd5f0 libdispatch.dylib`_dispatch_client_callout + 20
    frame #16: 0x00000001039c4fa8 libdispatch.dylib`_dispatch_lane_serial_drain + 736
    frame #17: 0x00000001039c5cb4 libdispatch.dylib`_dispatch_lane_invoke + 448
    frame #18: 0x00000001039d1e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
    frame #19: 0x00000001d76f0908 libsystem_pthread.dylib`_pthread_wqthread + 276
  thread #16
    frame #0: 0x00000001d76f7774 libsystem_pthread.dylib`start_wqthread
  thread #17, name = 'com.apple.NSURLConnectionLoader'
    frame #0: 0x00000001bc6b2dd0 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001bc6b2184 libsystem_kernel.dylib`mach_msg + 76
    frame #2: 0x0000000190e14cf8 CoreFoundation`__CFRunLoopServiceMachPort + 380
    frame #3: 0x0000000190e0eea8 CoreFoundation`__CFRunLoopRun + 1216
    frame #4: 0x0000000190e0e4bc CoreFoundation`CFRunLoopRunSpecific + 600
    frame #5: 0x00000001916c7050 CFNetwork`___lldb_unnamed_symbol11376$$CFNetwork + 572
    frame #6: 0x00000001921f60f0 Foundation`__NSThread__start__ + 864
    frame #7: 0x00000001d76eeca8 libsystem_pthread.dylib`_pthread_start + 320
  thread #18
    frame #0: 0x00000001d76f7774 libsystem_pthread.dylib`start_wqthread
  thread #19, queue = 'com.apple.network.connections'
    frame #0: 0x00000001039f1cb8 libdispatch.dylib`_dispatch_introspection_continuation_get_info + 204
    frame #1: 0x00000001039f3010 libdispatch.dylib`_dispatch_introspection_queue_item_dequeue_hook + 32
    frame #2: 0x00000001039c0428 libdispatch.dylib`_dispatch_continuation_pop + 396
    frame #3: 0x00000001039d4fec libdispatch.dylib`_dispatch_source_invoke + 1612
    frame #4: 0x00000001039c7180 libdispatch.dylib`_dispatch_workloop_invoke + 2100
    frame #5: 0x00000001039d1e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
    frame #6: 0x00000001d76f0908 libsystem_pthread.dylib`_pthread_wqthread + 276
  thread #20, queue = 'com.apple.MediaRemote.connectionQueue'
    frame #0: 0x00000001d7709594 libxpc.dylib`xpc_release + 28
    frame #1: 0x00000001d7715f50 libxpc.dylib`_xpc_connection_mach_event + 896
    frame #2: 0x00000001039bd6bc libdispatch.dylib`_dispatch_client_callout4 + 20
    frame #3: 0x00000001039d91f8 libdispatch.dylib`_dispatch_mach_msg_invoke + 520
    frame #4: 0x00000001039c4dd4 libdispatch.dylib`_dispatch_lane_serial_drain + 268
    frame #5: 0x00000001039da168 libdispatch.dylib`_dispatch_mach_invoke + 516
    frame #6: 0x00000001039c4dd4 libdispatch.dylib`_dispatch_lane_serial_drain + 268
    frame #7: 0x00000001039c5ce8 libdispatch.dylib`_dispatch_lane_invoke + 500
    frame #8: 0x00000001039d1e38 libdispatch.dylib`_dispatch_workloop_worker_thread + 1520
    frame #9: 0x00000001d76f0908 libsystem_pthread.dylib`_pthread_wqthread + 276

This stems from a more complex app using SRG Media Player, for which we know we have a deadlock due to a 3rd party dependency. Maybe this is all related and not an SRG Media Player bug.

defagos commented 4 years ago

Having a look at the threads my best guess is that the route detector and the route picker view are created at the same time. Depending on the timing this might create the issue we observe.

We could probably instantiate our route detector a bit earlier to avoid such issues.

defagos commented 4 years ago

I encountered the issue with SRG Media Player demo alone, so this is clearly related to it only.

I propose we try to enable route detection early. This way we will probably eliminate this issue.

defagos commented 4 years ago

Available for review on feature/various-fixes, which also contains a fix for modal presentation (made in Letterbox demo first).