wix-incubator / DetoxSync

Synchronization framework for Detox and other testing frameworks
MIT License
34 stars 16 forks source link

[NSNull __detox_sync_untrackAnimation]: unrecognized selector sent to instance #23

Open Kudo opened 2 years ago

Kudo commented 2 years ago

hi there!

we came across a crash issue from detox and in the call https://github.com/wix/DetoxSync/blob/962b297bf77f4c98decac40a2daa7b90394abe54/DetoxSync/DetoxSync/Spies/CAAnimation%2BDTXSpy.m#L30

this function is called after [UIViewPropertyAnimator stopAnimation:] but ios passing NSNull as the (CAAnimation *)anim parameter. does it make sense to check if the anim is NSNull like this?

the crash stacktrace is like this:

{
  messageId: -10000,
  params: {
    exceptionName: 'NSInvalidArgumentException',
    errorDetails: 'Exception was thrown: \n' +
      'NSInvalidArgumentException\n' +
      '-[NSNull __detox_sync_untrackAnimation]: unrecognized selector sent to instance 0x119d45fb0\n' +
      '(\n' +
      '\t0   CoreFoundation                      0x0000000119a54ba4 __exceptionPreprocess + 226\n' +
      '\t1   libobjc.A.dylib                     0x0000000110ad5be7 objc_exception_throw + 48\n' +
      '\t2   CoreFoundation                      0x0000000119a63821 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0\n' +
      '\t3   CoreFoundation                      0x0000000119a590bc ___forwarding___ + 1433\n' +
      '\t4   CoreFoundation                      0x0000000119a5b1e8 _CF_forwarding_prep_0 + 120\n' +
      '\t5   DetoxSync                           0x00000001446f9d75 -[_DTXCAAnimationDelegateHelper __detox_sync_animationDidStop:finished:] + 101\n' +
      '\t6   UIKitCore                           0x0000000132da183d __63-[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:]_block_invoke.978 + 493\n' +
      '\t7   UIKitCore                           0x0000000132da15b4 -[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:] + 847\n' +
      '\t8   UIKitCore                           0x0000000132d9b949 -[UIViewPropertyAnimator _runCompletions:finished:] + 37\n' +
      '\t9   BareExpoDetox                       0x00000001023fcef0 EXBlur.BlurEffectView.__deallocating_deinit + 160\n' +
      '\t10  BareExpoDetox                       0x00000001023fcf38 @objc EXBlur.BlurEffectView.__deallocating_deinit + 24\n' +
      '\t11  UIKitCore                           0x0000000132d4aeb9 __destroy_helper_block_e8_32s40s48s56s64s72s80s + 59\n' +
      '\t12  libsystem_blocks.dylib              0x0000000112b51434 _Block_release + 130\n' +
      '\t13  libsystem_blocks.dylib              0x0000000112b51434 _Block_release + 130\n' +
      '\t14  CoreFoundation                      0x000000011995335b __RELEASE_OBJECTS_IN_THE_ARRAY__ + 115\n' +
      '\t15  CoreFoundation                      0x00000001199532a1 -[__NSArrayM dealloc] + 275\n' +
      '\t16  libobjc.A.dylib                     0x0000000110ad39f7 objc_object::sidetable_release(bool, bool) + 177\n' +
      '\t17  UIKitCore                           0x0000000132d9b6d7 -[UIViewPropertyAnimator _clearAnimationState] + 358\n' +
      '\t18  UIKitCore                           0x0000000132d9a68b __61-[UIViewPropertyAnimator _setupAssociatedViewAnimationState:]_block_invoke + 168\n' +
      '\t19  UIKitCore                           0x0000000133f6758a -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 779\n' +
      '\t20  UIKitCore                           0x0000000133f37f81 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 231\n' +
      '\t21  UIKitCore                           0x0000000133f38526 -[UIViewAnimationState animationDidStop:finished:] + 263\n' +
      '\t22  UIKit                               0x0000000153569e2f -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 195\n' +
      '\t23  DetoxSync                           0x00000001446f9d64 -[_DTXCAAnimationDelegateHelper __detox_sync_animationDidStop:finished:] + 84\n' +
      '\t24  QuartzCore                          0x00000001128cd9b2 CA::Layer::run_animation_callbacks(void*) + 308\n' +
      '\t25  libdispatch.dylib                   0x0000000118bd1c0c _dispatch_client_callout + 8\n' +
      '\t26  libdispatch.dylib                   0x0000000118be0376 _dispatch_main_queue_callback_4CF + 1195\n' +
      '\t27  CoreFoundation                      0x00000001199c285d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9\n' +
      '\t28  CoreFoundation                      0x00000001199bd0ba __CFRunLoopRun + 2772\n' +
      '\t29  CoreFoundation                      0x00000001199bc103 CFRunLoopRunSpecific + 567\n' +
      '\t30  GraphicsServices                    0x000000011ccfacd3 GSEventRunModal + 139\n' +
      '\t31  UIKitCore                           0x00000001339b2e63 -[UIApplication _run] + 928\n' +
      '\t32  DetoxSync                           0x00000001446fc235 __detox_sync_UIApplication_run + 517\n' +
      '\t33  UIKitCore                           0x00000001339b7a53 UIApplicationMain + 101\n' +
      '\t34  BareExpoDetox                       0x00000001023414af main + 63\n' +
      '\t35  dyld                                0x000000010ffbfe1e start_sim + 10\n' +
      '\t36  ???                                 0x0000000207b9c4fe 0x0 + 8719549694\n' +
      '\t37  ???                                 0x0000000207b97000 0x0 + 8719527936\n' +
      '\t38  BareExpoDetox                       0x000000010233b000 __dso_handle + 0\n' +
      ')',
    queueName: 'com.apple.main-thread',
    exceptionReason: '-[NSNull __detox_sync_untrackAnimation]: unrecognized selector sent to instance 0x119d45fb0',
    threadNumber: 1
  },
  type: 'AppWillTerminateWithError'
}
d4vidi commented 2 years ago

@Kudo thanks for the report and suggestion. This does seem like a DetoxSync issue! Could you perhaps provide more details regarding the use case where this happens? Which navigation stack (and which navigation project) and what animation is in effect, among other things.

cc @asafkorem

Kudo commented 2 years ago

hi @d4vidi, this issue happens from detox testing with the code where we create a UIViewPropertyAnimator and stop it in destructor. you can search the animator property in the code above.

thanks for looking into this. let me know if you need any other information.

MortadhaFadhlaoui commented 1 year ago

Facing the same issue with react-native-video

    Exception was thrown: 
    NSInvalidArgumentException
    -[NSNull __detox_sync_untrackAnimation]: unrecognized selector sent to instance 0x1bbb347d8
    (
        0   CoreFoundation                      0x0000000180437324 __exceptionPreprocess + 160
        1   libobjc.A.dylib                     0x0000000180051274 objc_exception_throw + 56
        2   CoreFoundation                      0x0000000180445e3c +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
        3   CoreFoundation                      0x000000018043b224 ___forwarding___ + 1308
        4   CoreFoundation                      0x000000018043d50c _CF_forwarding_prep_0 + 92
        5   DetoxSync                           0x0000000103a452dc -[_DTXCAAnimationDelegateHelper __detox_sync_animationDidStop:finished:] + 76
        6   UIKitCore                           0x000000011803a7b4 __63-[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:]_block_invoke_4 + 276
        7   UIKitCore                           0x000000011803a600 -[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:] + 644
        8   UIKitCore                           0x00000001180366f8 -[UIViewPropertyAnimator _runCompletions:finished:] + 28
        9   AVKit                               0x0000000103b96de4 -[AVMobileChromelessControlsViewController _animateSliderToTintState:duration:completionHandler:] + 112
        10  AVKit                               0x0000000103b1e834 __70-[AVObservationController startObserving:keyPaths:observationHandler:]_block_invoke + 52
        11  AVKit                               0x0000000103b1e934 __105-[AVObservationController startObserving:keyPaths:includeInitialValue:includeChanges:observationHandler:]_block_invoke + 212
        12  AVKit                               0x0000000103b1f2dc -[AVProxyKVOObserver _handleValueChangeForKeyPath:ofObject:oldValue:newValue:context:] + 136
        13  AVKit                               0x0000000103b1f20c -[AVProxyKVOObserver observeValueForKeyPath:ofObject:change:context:] + 192
        14  Foundation                          0x0000000180b26b18 -[NSKeyValueObservance observeValueForKeyPath:ofObject:change:context:] + 320
        15  Foundation                          0x0000000180b2ef1c NSKeyValueNotifyObserver + 248
        16  Foundation                          0x0000000180b31e98 NSKeyValueDidChange + 352
        17  Foundation                          0x0000000180b2e4ac NSKeyValueDidChangeWithPerThreadPendingNotifications + 144
        18  Foundation                          0x0000000180b26adc -[NSKeyValueObservance observeValueForKeyPath:ofObject:change:context:] + 260
        19  Foundation                          0x0000000180b2ef1c NSKeyValueNotifyObserver + 248
        20  Foundation                          0x0000000180b31e98 NSKeyValueDidChange + 352
        21  Foundation                          0x0000000180b2e4ac NSKeyValueDidChangeWithPerThreadPendingNotifications + 144
        22  AVFCore                             0x00000001a7346a50 __avplayer_fpNotificationCallback_block_invoke + 1392
        23  DetoxSync                           0x0000000103a40434 ____detox_sync_dispatch_wrapper_block_invoke + 44
        24  libdispatch.dylib                   0x0000000180132ee4 _dispatch_call_block_and_release + 24
        25  libdispatch.dylib                   0x0000000180134708 _dispatch_client_callout + 16
        26  libdispatch.dylib                   0x0000000180143fd8 _dispatch_main_queue_drain + 1220
        27  libdispatch.dylib                   0x0000000180143b04 _dispatch_main_queue_callback_4CF + 40
        28  CoreFoundation                      0x000000018039a784 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
        29  CoreFoundation                      0x0000000180394de4 __CFRunLoopRun + 1912
        30  CoreFoundation                      0x0000000180394254 CFRunLoopRunSpecific + 584
        31  GraphicsServices                    0x0000000188eb7c9c GSEventRunModal + 160
        32  UIKitCore                           0x0000000118a2eff0 -[UIApplication _run] + 868
        33  DetoxSync                           0x0000000103a468dc __detox_sync_UIApplication_run + 376
        34  UIKitCore                           0x0000000118a32f3c UIApplicationMain + 124
        35  Aumio                               0x0000000100f370dc main + 80
        36  dyld                                0x00000001028a9514 start_sim + 20
        37  ???                                 0x0000000102961f28 0x0 + 4338360104
        38  ???                                 0x5f18000000000000 0x0 + 6852226833044209664
    )
talal-tilted commented 1 year ago

Did someone find a solution ? facing the same issue as @MortadhaFadhlaoui