Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox and TrustKit - Signal 6 was raised #1285

Closed
1 task done
JakeHiggins opened this issue Apr 15, 2019 · 7 comments
Closed
1 task done

Detox and TrustKit - Signal 6 was raised #1285

JakeHiggins opened this issue Apr 15, 2019 · 7 comments

Comments

@JakeHiggins
Copy link

Describe the bug
When attempting to run Detox alongside TrustKit in iOS (using the react-native-cert-pinner npm module) Signal 6 was raised error is produced. This error was presented in issues: #645 and #548, but no demo project was provided.

We have also seen #721, but it does not appear to have the same error that we are seeing.

To Reproduce

  • I have tested this issue on the latest Detox release and it still reproduces

Demo project: https://github.com/JakeHiggins/detox-trustkit-example
Please follow the instruction in the README, there is also a dump of the exact error log.

Expected behavior
When running the iOS tests, the Signal 6 was raised error should appear. This demo does not include Android because we do not experience this error while testing Detox and TrustKit on Android in our core project.

Screenshots
There is no in-app screenshot, the error occurs in the terminal while attempting to launch the app.

Environment (please complete the following information):

  • Detox: 12.1.4
  • React Native: 0.56.0
  • Node: 10.10.0
  • Device: iOS
  • Xcode: 10.1
  • iOS: 12.1
  • macOS: 10.14.2

Device and Verbose Detox Logs

detox[25678] INFO:  [test.js] configuration="ios.sim.debug" loglevel="error" artifactsLocation="artifacts/ios.sim.debug.2019-04-15 15-57-00Z" recordLogs="none" takeScreenshots="none" recordVideos="none" node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'
 FAIL  e2e/firstTest.spec.js (9.957s)
  Example
    ✕ should have welcome screen (6ms)

  ● Example › should have welcome screen

    Failed: "Signal 6 was raised
    (
    	0   Detox                               0x000000010728c446 _ZL16__DTXHandleCrashP11NSExceptionP8NSNumberP8NSString + 497
    	1   Detox                               0x000000010728c1cb _ZL17__DTXHandleSignali + 61
    	2   libsystem_platform.dylib            0x000000010c8dcb3d _sigtramp + 29
    	3   ???                                 0x000000000000ffff 0x0 + 65535
    	4   libsystem_c.dylib                   0x000000010c65ec45 abort + 127
    	5   EarlGrey                            0x000000011aeac403 -[NSURLSession(GREYAdditions) greyswizzled_dataTaskWithRequest:completionHandler:] + 995
    	6   example                             0x0000000106b3e31e -[RCTMultipartDataTask startTask] + 270
    	7   example                             0x0000000106b80776 _ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE + 902
    	8   example                             0x0000000106b8016f +[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] + 639
    	9   Detox                               0x0000000107285258 __dtx_loadBundleAtURL_onProgress_onComplete + 100
    	10  example                             0x0000000106afc0d8 -[RCTCxxBridge loadSource:onProgress:] + 1960
    	11  example                             0x0000000106afa8ee -[RCTCxxBridge start] + 7646
    	12  example                             0x0000000106bf9f85 -[RCTBridge setUp] + 901
    	13  example                             0x0000000106bf927b -[RCTBridge initWithDelegate:bundleURL:moduleProvider:launchOptions:] + 379
    	14  example                             0x0000000106bf9093 -[RCTBridge initWithBundleURL:moduleProvider:launchOptions:] + 147
    	15  example                             0x0000000106b369f9 -[RCTRootView initWithBundleURL:moduleName:initialProperties:launchOptions:] + 185
    	16  example                             0x0000000106ac5d1b -[AppDelegate application:didFinishLaunchingWithOptions:] + 251
    	17  Detox                               0x00000001072867ed -[DetoxAppDelegateProxy application:didFinishLaunchingWithOptions:] + 183
    	18  UIKitCore                           0x0000000113f74bde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
    	19  UIKitCore                           0x0000000113f765cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
    	20  UIKitCore                           0x0000000113f7bc2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
    	21  UIKitCore                           0x000000011379a4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
    	22  UIKitCore                           0x00000001137a329c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
    	23  UIKitCore                           0x000000011379a126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
    	24  UIKitCore                           0x000000011379aae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
    	25  UIKitCore                           0x0000000113798cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
    	26  UIKitCore                           0x000000011379895f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
    	27  UIKitCore                           0x000000011379da90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
    	28  UIKitCore                           0x000000011379e80e _performActionsWithDelayForTransitionContext + 100
    	29  UIKitCore                           0x000000011379d7ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
    	30  UIKitCore                           0x00000001137a293a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
    	31  UIKitCore                           0x0000000113f7a44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
    	32  UIKitCore                           0x0000000113b1ed09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
    	33  FrontBoardServices                  0x000000010e4292da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
    	34  FrontBoardServices                  0x000000010e434443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
    	35  FrontBoardServices                  0x000000010e433b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
    	36  libdispatch.dylib                   0x000000010c50254b _dispatch_client_callout + 8
    	37  libdispatch.dylib                   0x000000010c50560b _dispatch_block_invoke_direct + 312
    	38  FrontBoardServices                  0x000000010e468ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    	39  FrontBoardServices                  0x000000010e468860 -[FBSSerialQueue _performNext] + 457
    	40  FrontBoardServices                  0x000000010e468e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    	41  CoreFoundation                      0x00000001095c5721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    	42  CoreFoundation                      0x00000001095c4f93 __CFRunLoopDoSources0 + 243
    	43  CoreFoundation                      0x00000001095bf63f __CFRunLoopRun + 1263
    	44  CoreFoundation                      0x00000001095bee11 CFRunLoopRunSpecific + 625
    	45  GraphicsServices                    0x000000010ed431dd GSEventRunModal + 62
    	46  Detox                               0x00000001072835b3 __detox_run + 284
    	47  UIKitCore                           0x0000000113f7d81d UIApplicationMain + 140
    	48  example                             0x0000000106ac60f0 main + 112
    	49  libdyld.dylib                       0x000000010c572575 start + 1
    )"

       6 | jasmine.getEnv().addReporter(adapter);
       7 |
    >  8 | beforeAll(async () => {
         | ^
       9 |   await detox.init(config);
      10 | });
      11 |

      at Env.beforeAll (../node_modules/jest-jasmine2/build/jasmine_async.js:55:24)
      at Object.beforeAll (init.js:8:1)

  ● Example › should have welcome screen

    ReferenceError: device is not defined

      1 | describe('Example', () => {
      2 |   beforeEach(async () => {
    > 3 |     await device.launchApp({ delete: true });
        |           ^
      4 |   });
      5 |
      6 |   it('should have welcome screen', async () => {

      at Object.device (firstTest.spec.js:3:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee (firstTest.spec.js:2:14)

  ● Example › should have welcome screen

    ReferenceError: element is not defined

      4 |   });
      5 |
    > 6 |   it('should have welcome screen', async () => {
        |                                    ^
      7 |     await expect(element(by.text('Test Hello'))).toBeVisible();
      8 |   });
      9 | });

      at Object._callee2$ (firstTest.spec.js:6:36)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:296:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/regenerator-runtime/runtime.js:195:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:194:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:217:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:114:21)
      at Object.<anonymous>.runtime.async (../node_modules/regenerator-runtime/runtime.js:241:14)
      at Object._callee2 (firstTest.spec.js:6:36)

detox[25679] ERROR: [index.js/DETOX_INIT_ERROR]
 Signal 6 was raised
(
	0   Detox                               0x000000010728c446 _ZL16__DTXHandleCrashP11NSExceptionP8NSNumberP8NSString + 497
	1   Detox                               0x000000010728c1cb _ZL17__DTXHandleSignali + 61
	2   libsystem_platform.dylib            0x000000010c8dcb3d _sigtramp + 29
	3   ???                                 0x000000000000ffff 0x0 + 65535
	4   libsystem_c.dylib                   0x000000010c65ec45 abort + 127
	5   EarlGrey                            0x000000011aeac403 -[NSURLSession(GREYAdditions) greyswizzled_dataTaskWithRequest:completionHandler:] + 995
	6   example                             0x0000000106b3e31e -[RCTMultipartDataTask startTask] + 270
	7   example                             0x0000000106b80776 _ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE + 902
	8   example                             0x0000000106b8016f +[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] + 639
	9   Detox                               0x0000000107285258 __dtx_loadBundleAtURL_onProgress_onComplete + 100
	10  example                             0x0000000106afc0d8 -[RCTCxxBridge loadSource:onProgress:] + 1960
	11  example                             0x0000000106afa8ee -[RCTCxxBridge start] + 7646
	12  example                             0x0000000106bf9f85 -[RCTBridge setUp] + 901
	13  example                             0x0000000106bf927b -[RCTBridge initWithDelegate:bundleURL:moduleProvider:launchOptions:] + 379
	14  example                             0x0000000106bf9093 -[RCTBridge initWithBundleURL:moduleProvider:launchOptions:] + 147
	15  example                             0x0000000106b369f9 -[RCTRootView initWithBundleURL:moduleName:initialProperties:launchOptions:] + 185
	16  example                             0x0000000106ac5d1b -[AppDelegate application:didFinishLaunchingWithOptions:] + 251
	17  Detox                               0x00000001072867ed -[DetoxAppDelegateProxy application:didFinishLaunchingWithOptions:] + 183
	18  UIKitCore                           0x0000000113f74bde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
	19  UIKitCore                           0x0000000113f765cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
	20  UIKitCore                           0x0000000113f7bc2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
	21  UIKitCore                           0x000000011379a4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
	22  UIKitCore                           0x00000001137a329c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
	23  UIKitCore                           0x000000011379a126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
	24  UIKitCore                           0x000000011379aae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
	25  UIKitCore                           0x0000000113798cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
	26  UIKitCore                           0x000000011379895f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
	27  UIKitCore                           0x000000011379da90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
	28  UIKitCore                           0x000000011379e80e _performActionsWithDelayForTransitionContext + 100
	29  UIKitCore                           0x000000011379d7ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
	30  UIKitCore                           0x00000001137a293a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
	31  UIKitCore                           0x0000000113f7a44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
	32  UIKitCore                           0x0000000113b1ed09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
	33  FrontBoardServices                  0x000000010e4292da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
	34  FrontBoardServices                  0x000000010e434443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
	35  FrontBoardServices                  0x000000010e433b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
	36  libdispatch.dylib                   0x000000010c50254b _dispatch_client_callout + 8
	37  libdispatch.dylib                   0x000000010c50560b _dispatch_block_invoke_direct + 312
	38  FrontBoardServices                  0x000000010e468ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	39  FrontBoardServices                  0x000000010e468860 -[FBSSerialQueue _performNext] + 457
	40  FrontBoardServices                  0x000000010e468e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
	41  CoreFoundation                      0x00000001095c5721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	42  CoreFoundation                      0x00000001095c4f93 __CFRunLoopDoSources0 + 243
	43  CoreFoundation                      0x00000001095bf63f __CFRunLoopRun + 1263
	44  CoreFoundation                      0x00000001095bee11 CFRunLoopRunSpecific + 625
	45  GraphicsServices                    0x000000010ed431dd GSEventRunModal + 62
	46  Detox                               0x00000001072835b3 __detox_run + 284
	47  UIKitCore                           0x0000000113f7d81d UIApplicationMain + 140
	48  example                             0x0000000106ac60f0 main + 112
	49  libdyld.dylib                       0x000000010c572575 start + 1
)
Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        10.01s
Ran all test suites with tests matching "^((?!:android:).)*$".
detox[25678] ERROR: [cli.js] Error: Command failed: node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@LeoNatan
Copy link
Contributor

Hello

This issue seems the same as #721.
As discussed there, we are blocked by Google (see google/EarlGrey#709 and our PR for this specific issue—still not merged—google/EarlGrey#710). Please comment on the Google issues to help make our fix happen.

As a workaround, please use kTSKSwizzleNetworkDelegates: @NO, as mentioned in the other issue.

@LeoNatan
Copy link
Contributor

LeoNatan commented Apr 15, 2019

I see you mention #721 in your comment. It looks to me like a similar issue, but I could be mistaken. I will test in the coming days your example project (please do not remove the repo), and will see if related or a new issue.

@LeoNatan
Copy link
Contributor

Seems like the crash is exactly what is fixed here https://github.com/google/EarlGrey/pull/710/files#diff-c79d061dda0f28726f49fe56ac8a08a2R66, no?

@LeoNatan
Copy link
Contributor

Please nudge the Google guys to accept my PR. In the mean time, use the workaround provided above.

@JakeHiggins
Copy link
Author

Thank you for the response and temporary solution, I will nudge the PR that is in flight!

@JakeHiggins
Copy link
Author

As a note for anyone trying this before the EarlGrey PR is accepted: adding kTSKSwizzleNetworkDelegates: @NO to the Info.plist will allow Detox to launch iOS, but will also cause cert pinning to stop working; just a heads up.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 21, 2019
@LeoNatan
Copy link
Contributor

Good news, our PR was accepted and we will update Earl Grey soon to include the fix. Follow #1392.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants