Azure / azure-sdk-for-ios

iOS client SDKs for Microsoft Azure
https://azure.github.io/azure-sdk-for-ios/
MIT License
185 stars 88 forks source link

[BUG] Issue with call.hangUp(options: nil) Triggering Thread Performance Checker Warning #1832

Open ShawnHuangS opened 1 month ago

ShawnHuangS commented 1 month ago

Describe the bug When I call call.hangUp(options: nil), I always get the following warning:

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a thread without a QoS class specified (base priority 31). Investigate ways to avoid priority inversions.

Sometimes this causes my screen to freeze for several seconds, almost like a system crash.

Exception or Stack Trace

Thread Performance Checker: Thread running at User-initiated quality-of-service class waiting on a thread without a QoS class specified (base priority 31). Investigate ways to avoid priority inversions PID: 1986, TID: 720870 Backtrace ============================ 3 AzureCommunicationCalling 0x00000001085c448c _ZN3spl9eventWaitERPNS_8EventGCDE + 44 4 AzureCommunicationCalling 0x000000010863c130 _ZN25SplOpaqueUpperLayerThread8joinCoreENSt318optionalINS0_6chrono8durationIxNS0_5ratioILl1ELl1000000EEEEEEEPl + 164 5 AzureCommunicationCalling 0x000000010863c234 _ZN25SplOpaqueUpperLayerThread4stopENSt318optionalINS0_6chrono8durationIxNS0_5ratioILl1ELl1000000EEEEEEEPl + 72 6 AzureCommunicationCalling 0x000000010793e5f4 _ZN17HeartbeatReporter4StopEv + 124 7 AzureCommunicationCalling 0x00000001074ed4dc RtmCodecsHeartbeatReporterStop + 84 8 AzureCommunicationCalling 0x00000001073acf68 _ZN24CSlimStreamingEngineImpl37UpdateRunningConferenceAndHandleTimerE19ConferenceInfoStateS0_P23CSlimConferenceInfoImpl + 488 9 AzureCommunicationCalling 0x00000001073af7bc _ZNSt3110function6funcIZN24CSlimStreamingEngineImpl13StopTransportE16CTransportHandleE4$_13NS_9allocatorIS4EEFiP23CSlimConferenceInfoImplEEclEOS8 + 144 10 AzureCommunicationCalling 0x00000001073ac738 _ZN24CSlimStreamingEngineImpl25_FindConferenceAndExecuteI16CTransportHandleEEiT_RKNSt318functionIFiP23CSlimConferenceInfoImplEEE + 100 11 AzureCommunicationCalling 0x00000001073ac9c4 _ZN24CSlimStreamingEngineImpl13StopTransportE16CTransportHandle + 120 12 AzureCommunicationCalling 0x000000010726a8e0 _ZN6engine6detail7ApiBaseINS09EngineApiEE11ApiCallImplI19IStreamingEngineApiJ16CTransportHandleEE6InvokeEPS5 + 68 13 AzureCommunicationCalling 0x0000000107268b74 _ZN6engine6detail7ApiBaseINS0_9EngineApiEE8ForwardII19IStreamingEngineApiNSt3__110shared_ptrINS0_15EngineApiTracerEEEEEiRNS3_7ApiCallIT_EERKT0_PKcNS3_4FlagE + 224 14 AzureCommunicationCalling 0x0000000107265fe8 _ZN6engine6detail9EngineApi13StopTransportE16CTransportHandle + 140 15 AzureCommunicationCalling 0x0000000107cee1bc _ZN11RtpEndpoint24DeallocateLocalEndpointsEv + 160 16 AzureCommunicationCalling 0x0000000107e070b4 _ZN17CRTCMediaEndpoint8ShutdownEv + 168 17 AzureCommunicationCalling 0x0000000107e06e94 _ZN24CRTCMediaEndpointManager8ShutdownEv + 216 18 AzureCommunicationCalling 0x0000000107e6f538 _ZN11CRTCChannel27CacheMetricsOnStreamRemovalEv + 448 19 AzureCommunicationCalling 0x0000000107e6e328 _ZN11CRTCChannel18CommitRemoveStreamEb + 320 20 AzureCommunicationCalling 0x0000000107e6df8c _ZN11CRTCChannel8ShutdownEv + 712 21 AzureCommunicationCalling 0x0000000107ddff0c _ZN17CMediaChannelImpl9TerminateEb + 420 22 AzureCommunicationCalling 0x0000000107e28678 _ZN14CMediaFlowImpl17TerminateChannelsEh + 304 23 AzureCommunicationCalling 0x0000000107e28e08 _ZN14CMediaFlowImpl9TerminateEv + 448 24 AzureCommunicationCalling 0x0000000108181524 _ZN2ma6MMConf13TerminateFlowEv + 568 25 AzureCommunicationCalling 0x000000010811e4bc _ZN2ma10Conference9terminateENS_15TerminateReasonE + 1196 26 AzureCommunicationCalling 0x000000010822f884 _ZN3csa5CCall7cleanupEv + 136 27 AzureCommunicationCalling 0x00000001086481e0 _ZN3auf4priv13MRMWTransport11tryDispatchEPNS_11IDispatcherE + 164 28 AzureCommunicationCalling 0x00000001086428b8 _ZN3auf17StrandExecutorImp11tryDispatchEPNS_11IDispatcherE + 24 29 AzureCommunicationCalling 0x0000000108642718 _ZN3auf17StrandExecutorImp13depleteStrandEN2rt12IntrusivePtrIS0_EE + 100 30 AzureCommunicationCalling 0x0000000108642ab8 _ZN3auf3VarIMNS_17StrandExecutorImpEFvN2rt12IntrusivePtrIS1_EEERS1_JRS4_EE8dispatchEv + 80 31 AzureCommunicationCalling 0x00000001086417cc _ZN3auf24NativeThreadPoolExecutor20callFromNativeWorkerEPN3spl7VarBaseEPv + 56 32 AzureCommunicationCalling 0x0000000108641988 _ZN3spl4priv23NativeThreadPoolManager8dispatchERKDnP16dispatch_queue_sPFvPNS_7VarBaseEPvES7_S8block_invoke + 64 33 libdispatch.dylib 0x0000000102a0cb98 _dispatch_call_block_and_release + 32 34 libdispatch.dylib 0x0000000102a0e7bc _dispatch_client_callout + 20 35 libdispatch.dylib 0x0000000102a1130c _dispatch_queue_override_invoke + 1056 36 libdispatch.dylib 0x0000000102a22ae4 _dispatch_root_queue_drain + 404 37 libdispatch.dylib 0x0000000102a234d8 _dispatch_worker_thread2 + 188 38 libsystem_pthread.dylib 0x00000001f0eaf8f8 _pthread_wqthread + 228 39 libsystem_pthread.dylib 0x00000001f0eac0cc start_wqthread + 8

To Reproduce

  1. Call the method call.hangUp(options: nil).
  2. Observe the Thread Performance Checker warning.
  3. Notice that the screen might freeze for several seconds.

Code Snippet

self.call?.hangUp(options: nil) { error in
    if let error = error {
        DDLog("Failed to hang up: \(error.localizedDescription)")
    } else {
        DDLog("Call ended successfully")
    }
    self.deviceManager = nil
    self.call?.delegate = nil
    self.call = nil
    completion?()
}

Expected behavior I expected that calling call.hangUp(options: nil) would hang up the call without triggering any warnings or causing the screen to freeze.

Additional context I am using CallKit.

Setup (please complete the following information):

Thanks in advance for your help!

tjprescott commented 1 month ago

@raosanat can you take a look?