Laerdal / Xamarin.AzureCommunicationCalling

Xamarin iOS and Android binding libraries for Microsofts Azure Communication Services
MIT License
36 stars 11 forks source link

iOS: ACSException - Attempting to get event handler for a cookie which was never added. #31

Closed jveenhuizen closed 2 years ago

jveenhuizen commented 2 years ago

Hello!

I put the AzureCalling code in an iOS app and it works for the most part. However, sometimes (~50%) I have a crash when I hang up the call. See stack trace below. Does anyone else have this problem or am I missing something? I get almost the same crash every now and then when answering a call (~10%).


2022-07-04 12:51:54.006 DentalCoach.iOS[50485:11389458] Unhandled managed exception: Objective-C exception thrown.  Name: ACSException Reason: Attempting to get event handler for a cookie which was never added.
Native stack trace:
    0   CoreFoundation                      0x00000001833f129c 5198FB57-5645-3B34-A49F-F32B52256CF3 + 627356
    1   libobjc.A.dylib                     0x000000019c0eb744 objc_exception_throw + 60
    2   CoreFoundation                      0x0000000183448390 5198FB57-5645-3B34-A49F-F32B52256CF3 + 983952
    3   AzureCommunicationCalling           0x0000000109f39a5c +[ACSProjectedObjectEventHandlerCache getEventHandler:isEventPublic:] + 232
    4   AzureCommunicationCalling           0x0000000109f38f50 __static_remoteParticipantOnVideoStreamsUpdated_block_invoke + 76
    5   AzureCommunicationCalling           0x0000000109f3939c +[ACSProjectedObjectCache getOrCreate:factoryBlock:] + 236
    6   AzureCommunicationCalling           0x0000000109f32458 static_remoteParticipantOnVideoStreamsUpdated + 100
    7   AzureCommunicationCalling           0x0000000109fb3238 _ZN22sam_remote_participant24updateAndRaiseVideoEventEjj + 336
    8   AzureCommunicationCalling           0x0000000109fb5204 _ZN23sam_remote_video_stream27timerForRemovedEventExpiredEN2rt12IntrusivePtrIS_EE + 364
    9   AzureCommunicationCalling           0x0000000109fb5954 _ZN3auf3VarIM23sam_remote_video_streamFvN2rt12IntrusivePtrIS1_EEERS1_JRS4_EE8dispatchEv + 60
    10  AzureCommunicationCalling           0x000000010b31b620 _ZN3auf12TimerHandler16callExpiredTimerERNS_22SignalAndReleaseAtLastE + 88
    11  AzureCommunicationCalling           0x000000010b32020c _ZN3auf4priv13MRMWTransport11tryDispatchEPNS_11IDispatcherE + 136
    12  AzureCommunicationCalling           0x000000010b31a8dc _ZN3auf17StrandExecutorImp11tryDispatchEPNS_11IDispatcherE + 24
    13  AzureCommunicationCalling           0x000000010b31a754 _ZN3auf17StrandExecutorImp13depleteStrandEN2rt12IntrusivePtrIS0_EE + 84
    14  AzureCommunicationCalling           0x000000010b31ab80 _ZN3auf8internal12async_method5applyIRNS_17StrandExecutorImpEMS3_FvN2rt12IntrusivePtrIS3_EEENSt3__15tupleIJS7_EEEJLm0EEEEDTcldsclsr3stdE7forwardIT_Efp_Efp0_spscNS0_19async_required_castIXT2_EN3spl8internal16inspect_callableIT0_E3get10args_tupleET1_E4typeEclsr3stdE3getIXT2_EEfp1_EEEOSD_SI_RSL_NSG_3seqIJXspT2_EEEE + 56
    15  AzureCommunicationCalling           0x000000010b319904 _ZN3auf24NativeThreadPoolExecutor20callFromNativeWorkerEPN3spl7VarBaseEPv + 56
    16  AzureCommunicationCalling           0x000000010b319a6c ___ZN3spl4priv23NativeThreadPoolManager8dispatchERKDnP16dispatch_queue_sPFvPNS_7VarBaseEPvES7_S8__block_invoke + 48
    17  libdispatch.dylib                   0x0000000183056e6c 355ACCF4-3917-3730-BC55-EF7003887ABE + 7788
    18  libdispatch.dylib                   0x0000000183058a30 355ACCF4-3917-3730-BC55-EF7003887ABE + 14896
    19  libdispatch.dylib                   0x000000018306a280 355ACCF4-3917-3730-BC55-EF7003887ABE + 86656
    20  libdispatch.dylib                   0x000000018306a96c 355ACCF4-3917-3730-BC55-EF7003887ABE + 88428
    21  libsystem_pthread.dylib             0x00000001f4534080 _pthread_wqthread + 228
    22  libsystem_pthread.dylib             0x00000001f4533e5c start_wqthread + 8
 (Foundation.MonoTouchException)

=================================================================
    Native Crash Reporting
=================================================================
Got a abrt while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x106f3d930 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f33a7c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f3ce78 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10b2aa924 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3spl4privL27logCriticalBackTraceHandlerEiP9__siginfoPv
    0x1f452cc10 - /usr/lib/system/libsystem_platform.dylib : <redacted>
    0x1f453a3bc - /usr/lib/system/libsystem_pthread.dylib : pthread_kill
    0x18e4f7524 - /usr/lib/system/libsystem_c.dylib : abort
    0x1070f869c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_find_protocol_wrapper_type
    0x106f9e318 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : mono_pmip
    0x106f33484 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f31e58 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f27b58 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10502ec2c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10700ab98 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : mono_pmip
    0x1070f8370 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_get_block_descriptor
    0x1070f81a4 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_get_block_descriptor
    0x1070f815c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_get_block_descriptor
    0x106f329dc - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f31e58 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x106f27b58 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10502ec2c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10510a690 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x105106454 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x10516bb10 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy
    0x1070f4f1c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_get_block_descriptor
    0x1070f8e00 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/DentalCoach.iOS : xamarin_find_protocol_wrapper_type
    0x183472520 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
    0x19c0f1c5c - /usr/lib/libobjc.A.dylib : <redacted>
    0x19c1f5f18 - /usr/lib/libc++abi.dylib : <redacted>
    0x19c1f8c1c - /usr/lib/libc++abi.dylib : __cxa_get_exception_ptr
    0x19c1f8bc8 - /usr/lib/libc++abi.dylib : <redacted>
    0x19c0eb8ac - /usr/lib/libobjc.A.dylib : objc_exception_throw
    0x183448390 - /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : <redacted>
    0x109f39a5c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : +[ACSProjectedObjectEventHandlerCache getEventHandler:isEventPublic:]
    0x109f38f50 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : __static_remoteParticipantOnVideoStreamsUpdated_block_invoke
    0x109f3939c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : +[ACSProjectedObjectCache getOrCreate:factoryBlock:]
    0x109f32458 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : static_remoteParticipantOnVideoStreamsUpdated
    0x109fb3238 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN22sam_remote_participant24updateAndRaiseVideoEventEjj
    0x109fb5204 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN23sam_remote_video_stream27timerForRemovedEventExpiredEN2rt12IntrusivePtrIS_EE
    0x109fb5954 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf3VarIM23sam_remote_video_streamFvN2rt12IntrusivePtrIS1_EEERS1_JRS4_EE8dispatchEv
    0x10b31b620 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf12TimerHandler16callExpiredTimerERNS_22SignalAndReleaseAtLastE
    0x10b32020c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf4priv13MRMWTransport11tryDispatchEPNS_11IDispatcherE
    0x10b31a8dc - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf17StrandExecutorImp11tryDispatchEPNS_11IDispatcherE
    0x10b31a754 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf17StrandExecutorImp13depleteStrandEN2rt12IntrusivePtrIS0_EE
    0x10b31ab80 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf8internal12async_method5applyIRNS_17StrandExecutorImpEMS3_FvN2rt12IntrusivePtrIS3_EEENSt3__15tupleIJS7_EEEJLm0EEEEDTcldsclsr3stdE7forwardIT_Efp_Efp0_spscNS0_19async_required_castIXT2_EN3spl8internal16inspect_callableIT0_E3get10args_tupleET1_E4typeE
    0x10b319904 - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : _ZN3auf24NativeThreadPoolExecutor20callFromNativeWorkerEPN3spl7VarBaseEPv
    0x10b319a6c - /private/var/containers/Bundle/Application/4B928FA2-5296-4AED-9BB2-A384DAB484EC/DentalCoach.iOS.app/Frameworks/AzureCommunicationCalling.framework/AzureCommunicationCalling : ___ZN3spl4priv23NativeThreadPoolManager8dispatchERKDnP16dispatch_queue_sPFvPNS_7VarBaseEPvES7_S8__block_invoke
    0x183056e6c - /usr/lib/system/libdispatch.dylib : <redacted>
    0x183058a30 - /usr/lib/system/libdispatch.dylib : <redacted>
    0x18306a280 - /usr/lib/system/libdispatch.dylib : <redacted>
    0x18306a96c - /usr/lib/system/libdispatch.dylib : <redacted>
    0x1f4534080 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
    0x1f4533e5c - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1bae2db38):0x1bae2db28  ff 0f 5f d6 c0 03 5f d6 10 29 80 d2 01 10 00 d4  .._..._..)......
0x1bae2db38  03 01 00 54 7f 23 03 d5 fd 7b bf a9 fd 03 00 91  ...T.#...{......
0x1bae2db48  a6 ed ff 97 bf 03 00 91 fd 7b c1 a8 ff 0f 5f d6  .........{...._.
0x1bae2db58  c0 03 5f d6 7f 23 03 d5 fd 7b bf a9 fd 03 00 91  .._..#...{......

=================================================================
    Managed Stacktrace:
=================================================================
=================================================================
andersonvieiragomeslopes commented 2 years ago

Hello @jveenhuizen

I ran into the dispose problem here, but I work with non-video calls. Do your calls have video or are they just audio? Did you use the methods in the example to end the call? Do you have the latest (2.2.0.1) version of the sdk?

Does the problem occur on the first call after starting the app or on all calls? If it only happens from the first one, I think that the dispose is not enough and in my case I canceled the call so before closing the call I check if it is null and at the end I do this

image

tompi commented 2 years ago

I have seen this, but its been a while...

Like @andersonvieiragomeslopes , i think its due to lacking cleanup, but not sure... My cleanup code has been through some iterations, and at the moment it looks almost like andersons, except I also dispose the callagent, that might not be an option for you...

I also set every local to null and also cleanup event listeners.

I reported a bug to ms on this, at least i think its the same: https://github.com/Azure/Communication/issues/440

jveenhuizen commented 2 years ago

Thank you for the reply's!

Do your calls have video or are they just audio?

I'm using video

Did you use the methods in the example to end the call?

Yes I did!

Do you have the latest (2.2.0.1) version of the sdk?

I'm using 2.2.0-beta 1.4 (released for other bugfix) will try 2.2.0.1 now

Does the problem occur on the first call after starting the app or on all calls?

Yes it also happens from the first call, both answering and hanging up the call

I also set every local to null and also cleanup event listeners.

I'll try also today, hope it helps :-)

tompi commented 2 years ago

@jveenhuizen some more details here: https://github.com/Azure/Communication/issues/423

jveenhuizen commented 2 years ago

Updated to 2.2.0.1, added null checks and did some more cleanups. I haven't seen it since... fingers crossed I think?

tompi commented 2 years ago

hehe, programming and religion shouldn't be this similar, but sometimes all we can do is thoughts and prayers... keeping this open for a while, let me know if it happens again!

tompi commented 2 years ago

Assuming this is fixed since it is not occuring anymore, feel free to reopen if its still a problem