Azure / azure-sdk-for-ios

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

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

Open ShawnHuangS opened 4 months ago

ShawnHuangS commented 4 months 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 4 months ago

@raosanat can you take a look?

lucianopa-msft commented 1 month ago

Hey @ShawnHuangS, Sorry we took a long time to respond, if there is still an issue, do you mind trying with 2.13.0 version of SDK to verify if issue has been fixed? Thanks

ShawnHuangS commented 1 month ago

Hey @lucianopa-msft ,

Thanks for getting back to me! I also had to update the SDK due to the Xcode update. I’ll test the new SDK with the next app version, or we can close this issue for now since we won’t be using version 2.9.0 anymore.

Thanks again!

lucianopa-msft commented 1 month ago

Hi @ShawnHuangS, Let's leave this open up until you are able to verify, if issue still persists we have to need this open for tracking Let us know about the results once you verify :)

abulkalam-dsi commented 3 weeks ago

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 PID: 3293, TID: 1612160 Backtrace

3 AzureCommunicationCalling 0x0000000109836528 _ZN3spl9eventWaitERPNS_8EventGCDE + 44 4 AzureCommunicationCalling 0x00000001098abf30 _ZN25SplOpaqueUpperLayerThread8joinCoreENSt318optionalINS0_6chrono8durationIxNS0_5ratioILl1ELl1000000EEEEEEEPl + 160 5 AzureCommunicationCalling 0x00000001098ac034 _ZN25SplOpaqueUpperLayerThread4stopENSt318optionalINS0_6chrono8durationIxNS0_5ratioILl1ELl1000000EEEEEEEPl + 72 6 AzureCommunicationCalling 0x0000000108a9e844 _ZN17HeartbeatReporter4StopEv + 124 7 AzureCommunicationCalling 0x00000001086d015c RtmCodecsHeartbeatReporterStop + 88 8 AzureCommunicationCalling 0x0000000108563358 _ZN24CSlimStreamingEngineImpl37UpdateRunningConferenceAndHandleTimerE19ConferenceInfoStateS0_P23CSlimConferenceInfoImpl + 424 9 AzureCommunicationCalling 0x0000000108565aa8 _ZNSt3110function6funcIZN24CSlimStreamingEngineImpl13StopTransportE16CTransportHandleE4$_13NS_9allocatorIS4EEFiP23CSlimConferenceInfoImplEEclEOS8 + 144 10 AzureCommunicationCalling 0x0000000108562b98 _ZN24CSlimStreamingEngineImpl25_FindConferenceAndExecuteI16CTransportHandleEEiT_RKNSt318functionIFiP23CSlimConferenceInfoImplEEE + 100 11 AzureCommunicationCalling 0x0000000108562e00 _ZN24CSlimStreamingEngineImpl13StopTransportE16CTransportHandle + 120 12 AzureCommunicationCalling 0x00000001084ae728 _ZN6engine6detail7ApiBaseINS09EngineApiEE11ApiCallImplI19IStreamingEngineApiJ16CTransportHandleEE6InvokeEPS5 + 68 13 AzureCommunicationCalling 0x00000001084ac7d4 _ZN6engine6detail7ApiBaseINS0_9EngineApiEE8ForwardII19IStreamingEngineApiNSt3__110shared_ptrINS0_15EngineApiTracerEEEEEiRNS3_7ApiCallIT_EERKT0_PKcNS3_4FlagE + 216 14 AzureCommunicationCalling 0x00000001084a9a70 _ZN6engine6detail9EngineApi13StopTransportE16CTransportHandle + 140 15 AzureCommunicationCalling 0x0000000108f1d5d8 _ZN11RtpEndpoint24DeallocateLocalEndpointsEv + 164 16 AzureCommunicationCalling 0x000000010904022c _ZN17CRTCMediaEndpoint8ShutdownEv + 168 17 AzureCommunicationCalling 0x0000000109040054 _ZN24CRTCMediaEndpointManager8ShutdownEv + 212 18 AzureCommunicationCalling 0x00000001090a8098 _ZN11CRTCChannel27CacheMetricsOnStreamRemovalEv + 444 19 AzureCommunicationCalling 0x00000001090a6f90 _ZN11CRTCChannel18CommitRemoveStreamEb + 320 20 AzureCommunicationCalling 0x00000001090a6c40 _ZN11CRTCChannel8ShutdownEv + 716 21 AzureCommunicationCalling 0x0000000109019268 _ZN17CMediaChannelImpl9TerminateEb + 420 22 AzureCommunicationCalling 0x0000000109060f34 _ZN14CMediaFlowImpl17TerminateChannelsEh + 304 23 AzureCommunicationCalling 0x000000010906157c _ZN14CMediaFlowImpl9TerminateEv + 460 24 AzureCommunicationCalling 0x00000001093c3840 _ZN2ma6MMConf13TerminateFlowEv + 572 25 AzureCommunicationCalling 0x000000010935f4a4 _ZN2ma10Conference9terminateENS_15TerminateReasonE + 1136 26 AzureCommunicationCalling 0x0000000109471498 _ZN3csa5CCall7cleanupEv + 136 27 AzureCommunicationCalling 0x00000001098b8af8 _ZN3auf4priv13MRMWTransport11tryDispatchEPNS_11IDispatcherE + 156 28 AzureCommunicationCalling 0x00000001098b2724 _ZN3auf17StrandExecutorImp11tryDispatchEPNS_11IDispatcherE + 24 29 AzureCommunicationCalling 0x00000001098b25a8 _ZN3auf17StrandExecutorImp13depleteStrandEN2rt12IntrusivePtrIS0_EE + 100 30 AzureCommunicationCalling 0x00000001098b28e4 _ZN3auf3VarIMNS_17StrandExecutorImpEFvN2rt12IntrusivePtrIS1_EEERS1_JRS4_EE8dispatchEv + 80 31 AzureCommunicationCalling 0x00000001098b16f4 _ZN3auf24NativeThreadPoolExecutor20callFromNativeWorkerEPN3spl7VarBaseEPv + 56 32 AzureCommunicationCalling 0x00000001098b18b0 _ZN3spl4priv23NativeThreadPoolManager8dispatchERKDnP16dispatch_queue_sPFvPNS_7VarBaseEPvES7_S8block_invoke + 64 33 libdispatch.dylib 0x0000000103898b98 _dispatch_call_block_and_release + 32 34 libdispatch.dylib 0x000000010389a7bc _dispatch_client_callout + 20 35 libdispatch.dylib 0x000000010389d30c _dispatch_queue_override_invoke + 1056 36 libdispatch.dylib 0x00000001038aeae4 _dispatch_root_queue_drain + 404 37 libdispatch.dylib 0x00000001038af4d8 _dispatch_worker_thread2 + 188 38 libsystem_pthread.dylib 0x00000001ef9d48f8 _pthread_wqthread + 228 39 libsystem_pthread.dylib 0x00000001ef9d10cc start_wqthread + 8