Detox: Detox Crash Signal 5 - iOS

Description

We have been getting a weird intermittent crash on iOS Detox (latest version 18.7.1 but was occurring in v17 too). It happens right after the app launches.

 5 | describe('Signup Flow, and initial cards and messages', () => {
    > 6 |   beforeAll(async () => {
        |   ^
      7 |     await device.launchApp({ newInstance: true, permissions: { notifications: 'NO' } })
      8 |   })
  • I have tested this issue on the latest Detox release and it still reproduces

Reproduction

We started to see this crash start to occur in Detox when we upgraded Apollo from v2 to v3. So I imagine the steps might be:

  1. Open any React Native app that uses Apollo v3
  2. Build detox for iOS yarn detox:build
  3. Run detox for iOS yarn detox:ios

Expected behavior

No crash

Screenshots

Screen Shot 2021-03-15 at 8 36 58 PM

Environment (please complete the following information):

  • Detox: 18.7.1
  • React Native: 0.63.4
  • Node: 14.7.0
  • Device: iOS Simulator - iPhone 11
  • Xcode: 12.1
  • iOS: 14.1
  • macOS: 10.15.7 Catalina

Logs

 thrown: "Signal 5 was raised
    (
    	0   Detox                               0x0000000101fddeb5 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 37
    	1   Detox                               0x0000000101fe10c0 __DTXHandleCrash + 464
    	2   Detox                               0x0000000101fe1805 __DTXHandleSignal + 59
    	3   libsystem_platform.dylib            0x00007fff5e7305fd _sigtramp + 29
    	4   ???                                 0x0000000000000000 0x0 + 0
    	5   JavaScriptCore                      0x00007fff316bd2c6 JSC::JSLock::willReleaseLock() + 246
    	6   JavaScriptCore                      0x00007fff316bd174 JSC::JSLock::unlock(long) + 68
    	7   JavaScriptCore                      0x00007fff316bd461 JSC::JSLock::DropAllLocks::DropAllLocks(JSC::VM*) + 257
    	8   JavaScriptCore                      0x00007fff30d37687 JSC::JSCallbackObject<JSC::JSNonFinalObject>::call(JSC::JSGlobalObject*, JSC::CallFrame*) + 599
    	9   JavaScriptCore                      0x00007fff313fb9e1 JSC::handleHostCall(JSC::JSGlobalObject*, JSC::CallFrame*, JSC::JSValue, JSC::CallLinkInfo*) + 353
    	10  JavaScriptCore                      0x00007fff313fb34f operationLinkCall + 127
    	11  ???                                 0x0000425787802d67 0x0 + 72943702912359
    	12  ???                                 0x00004257879a9d06 0x0 + 72943704644870
    	13  ???                                 0x00004257879a6445 0x0 + 72943704630341
    	14  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	15  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	16  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	17  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	18  ???                                 0x0000425787a6b980 0x0 + 72943705438592
    	19  JavaScriptCore                      0x00007fff30cdcfb8 llint_entry + 112820
    	20  ???                                 0x0000425787cc94ef 0x0 + 72943707919599
    	21  ???                                 0x0000425787d1d9a6 0x0 + 72943708264870
    	22  ???                                 0x0000425787a5536a 0x0 + 72943705346922
    	23  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	24  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	25  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	26  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	27  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	28  ???                                 0x0000425787ac5f3c 0x0 + 72943705808700
    	29  ???                                 0x00004257879b3f6e 0x0 + 72943704686446
    	30  JavaScriptCore                      0x00007fff30cdbbb8 llint_entry + 107700
    	31  ???                                 0x0000425787c3723e 0x0 + 72943707320894
    	32  ???                                 0x0000425787d2020e 0x0 + 72943708275214
    	33  ???                                 0x0000425787ca700f 0x0 + 72943707779087
    	34  ???                                 0x0000425787a862d0 0x0 + 72943705547472
    	35  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	36  JavaScriptCore                      0x00007fff30cdaf09 llint_entry + 104453
    	37  ???                                 0x0000425787c372c2 0x0 + 72943707321026
    	38  ???                                 0x0000425787d2020e 0x0 + 72943708275214
    	39  ???                                 0x0000425787ca700f 0x0 + 72943707779087
    	40  JavaScriptCore                      0x00007fff30cc150f vmEntryToJavaScript + 216
    	41  JavaScriptCore                      0x00007fff3136cda6 JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 518
    	42  JavaScriptCore                      0x00007fff3166fb5a JSC::boundThisNoArgsFunctionCall(JSC::JSGlobalObject*, JSC::CallFrame*) + 714
    	43  ???                                 0x0000425787807cb7 0x0 + 72943702932663
    	44  ???                                 0x0000425787c372a1 0x0 + 72943707320993
    	45  ???                                 0x0000425787d2020e 0x0 + 72943708275214
    	46  ???                                 0x0000425787ca700f 0x0 + 72943707779087
    	47  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	48  ???                                 0x0000425787c3721d 0x0 + 72943707320861
    	49  ???                                 0x0000425787d2020e 0x0 + 72943708275214
    	50  ???                                 0x0000425787ca7180 0x0 + 72943707779456
    	51  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	52  ???                                 0x0000425787d2216f 0x0 + 72943708283247
    	53  ???                                 0x0000425787d2020e 0x0 + 72943708275214
    	54  ???                                 0x0000425787ca7180 0x0 + 72943707779456
    	55  JavaScriptCore                      0x00007fff30cdaf89 llint_entry + 104581
    	56  ???                                 0x0000425787d52939 0x0 + 72943708481849
    	57  ???                                 0x0000425787e3800b 0x0 + 72943709421579
    	58  ???                                 0x0000425787d523c2 0x0 + 72943708480450
    	59  ???                                 0x0000425787d29ed1 0x0 + 72943708315345
    	60  ???                                 0x0000425787c799b1 0x0 + 72943707593137
    	61  ???                                 0x0000425787ddfcab 0x0 + 72943709060267
    	62  ???                                 0x0000425787d3d068 0x0 + 72943708393576
    	63  ???                                 0x0000425787807c77 0x0 + 72943702932599
    	64  JavaScriptCore                      0x00007fff30cc150f vmEntryToJavaScript + 216
    	65  JavaScriptCore                      0x00007fff3136cda6 JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 518
    	66  JavaScriptCore                      0x00007fff3166fb5a JSC::boundThisNoArgsFunctionCall(JSC::JSGlobalObject*, JSC::CallFrame*) + 714
    	67  JavaScriptCore                      0x00007fff30cc1661 vmEntryToNative + 226
    	68  JavaScriptCore                      0x00007fff3136cddd JSC::Interpreter::executeCall(JSC::JSGlobalObject*, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 573
    	69  JavaScriptCore                      0x00007fff315bd114 JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 164
    	70  JavaScriptCore                      0x00007fff30d453d7 JSObjectCallAsFunction + 791
    	71  Patio-tests                         0x000000010119f2be facebook::jsc::JSCRuntime::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 166
    	72  Patio-tests                         0x00000001011a673a facebook::react::JSIExecutor::invokeCallback(double, folly::dynamic const&) + 172
    	73  Patio-tests                         0x000000010119b850 std::__1::__function::__func<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8, std::__1::allocator<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8>, void ()>::operator()() + 48
    	74  Patio-tests                         0x00000001010e37cb facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 25
    	75  Patio-tests                         0x00000001010f0528 facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 18
    	76  Patio-tests                         0x00000001010f0350 invocation function for block in facebook::react::RCTMessageThread::runAsync(std::__1::function<void ()>) + 33
    	77  DetoxSync                           0x0000000102d95c6d ____detox_sync_CFRunLoopPerformBlock_block_invoke + 23
    	78  CoreFoundation                      0x00007fff2038c110 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    	79  CoreFoundation                      0x00007fff2038b524 __CFRunLoopDoBlocks + 434
    	80  CoreFoundation                      0x00007fff20386595 __CFRunLoopRun + 2532
    	81  CoreFoundation                      0x00007fff203856c6 CFRunLoopRunSpecific + 567
    	82  Patio-tests                         0x00000001010d922a +[RCTCxxBridge runRunLoop] + 274
    	83  DetoxSync                           0x0000000102d98030 swz_runRunLoopThread + 291
    	84  Foundation                          0x00007fff20852e68 __NSThread__start__ + 1042
    	85  libsystem_pthread.dylib             0x00007fff5e73d109 _pthread_start + 148
    	86  libsystem_pthread.dylib             0x00007fff5e738b8b thread_start + 15
    )"

Screen Shot 2021-03-15 at 8 36 58 PM

Device and verbose Detox logs

TBD

  • I have run my tests using the --loglevel trace argument and am providing the verbose log below:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I was able to reproduce this while collaborating with @watadarkstar - but Adrian, I think what’s happening here is that Signal 5 is just “trap”, saying “there is something that registered an exception handler and we’ve trapped an exception, we’re handing it off” - I think Detox just registered an exception handler and is not actually responsible for the stack, rather it is a bystander here

This is the part of the stack that is the actual problem before detox trap handler gets it:


    	4   ???                                 0x0000000000000000 0x0 + 0
    	5   JavaScriptCore                      0x00007fff316bd2c6 JSC::JSLock::willReleaseLock() + 246
    	6   JavaScriptCore                      0x00007fff316bd174 JSC::JSLock::unlock(long) + 68
    	7   JavaScriptCore                      0x00007fff316bd461 JSC::JSLock::DropAllLocks::DropAllLocks(JSC::VM*) + 257
    	8   JavaScriptCore                      0x00007fff30d37687 JSC::JSCallbackObject<JSC::JSNonFinalObject>::call(JSC::JSGlobalObject*, JSC::CallFrame*) + 599
    	9   JavaScriptCore                      0x00007fff313fb9e1 JSC::handleHostCall(JSC::JSGlobalObject*, JSC::CallFrame*, JSC::JSValue, JSC::CallLinkInfo*) + 353
    	10  JavaScriptCore                      0x00007fff313fb34f operationLinkCall + 127

There’s a null dereference there from the JSC

My thoughts, knowing it’s a react-native project:

  • try hermes, it’s available now on iOS - I actually tried this and it worked 😃 (I was able to reproduce your stack all the time prior, this was also evidence to me for my assertion it was not detox, rather it was the JSC
  • try an updated version of the JSC? I have not tried this as I believe it is a system component and not available for update?

I think the action here for Detox (if you can call it that…) is to examine my assertion that this stack is JSC or not with Detox as bystander so it’s possible to know where to file it even, as an Apple Radar might be the most appropriate place

Update: I checked the swift code myself, looks like I was right. I’m going to have to close the issue, then - but of course, will keep it for further discussions.

As a general note, we’ve more than once found that Detox - being an executor of frequently run (automated) use cases (similar to any other testing framework), surfaces such issues.

@watadarkstar I’ve set up a build of our app without Sentry at all, and crashes persist. At least for our case I’d say I’m reasonably confident that Sentry does not have any involvement in these crashes.