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 verb instrumentationProcess terminated due to receipt of signal null #764

Closed
yogeshthanvi opened this issue Jun 1, 2018 · 25 comments

Comments

@yogeshthanvi
Copy link

yogeshthanvi commented Jun 1, 2018

I am facing an issue as mentioned in subject for Android . I am executing the test cases on Android device following are the details

Android version : 7.0

react-native-cli: 2.0.1
react-native: 0.45.1

detox-server info 17:22:44: server listening on localhost:55157...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"8d0aa206-e09c-96cc-4c0a-67bdd8e5e8de","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"8d0aa206-e09c-96cc-4c0a-67bdd8e5e8de","role":"tester"},"messageId":0}
detox verb ws  
detox verb 1: /Library/Android/sdk/platform-tools/adb  devices 
detox verb 1: stdout: List of devices attached
detox verb 1: stdout: WU01N8JP2	device
detox verb 1: stdout: emulator-5554	device
detox verb 1: stdout: 
detox verb 1: stdout: 
detox verb 2:/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell input keyevent 82 
detox verb 3: /Library/Android/sdk/platform-tools/adb -s WU01N8JP2 uninstall com.xxx.yyy
detox verb 3: stdout: Success
detox verb 3: stdout: 
detox verb 4: /Library/Android/sdk/platform-tools/adb -s WU01N8JP2 uninstall com.xxx.yyt.test 
detox verb 4: stdout: Success
detox verb 4: stdout: 
detox verb 5: /Users/punchh_yogesh/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell getprop ro.build.version.sdk 
detox verb 5: stdout: 24
detox verb 5: stdout: 
detox verb 6: /Library/Android/sdk/platform-tools/adb -s WU01N8JP2 install -r -g /Downloads/yyy/yyy/android/app/build/outputs/apk/debug/app-debug.apk 
detox verb 6: stdout: Success
detox verb 6: stdout: 
detox verb 7:/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell getprop ro.build.version.sdk 
detox verb 7: stdout: 24
detox verb 7: stdout: 
detox verb 8: /Users/punchh_yogesh/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 install -r -g /Users/punchh_yogesh/Downloads/xxxx/projectname/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk 
detox verb 8: stdout: Success
detox verb 8: stdout: 
detox verb 9: /Users/punchh_yogesh/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell am force-stop com.xxx.yyy
detox verb 10: /Users/punchh_yogesh/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell pm list instrumentation 
detox verb 10: stdout: instrumentation:com.xxx.project.test/android.support.test.runner.AndroidJUnitRunner (target=com.xxx.project)
detox verb 10: stdout: 
detox verb /Users/punchh_yogesh/Library/Android/sdk/platform-tools/adb -s WU01N8JP2 shell am instrument -w -r -e detoxServer ws://localhost:55157 -e detoxSessionId 8d0aa206-e09c-96cc-4c0a-67bdd8e5e8de -e debug false com.xxx.project.test/android.support.test.runner.AndroidJUnitRunner 
detox verb Instrumentation spawned, childProcess.pid:  35701
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.xxx.yyy.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.xxx.project.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_RESULT: shortMsg=Process crashed.
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_CODE: 0
detox verb Instrumentation stdout:  
detox verb instrumentationProcess terminated due to receipt of signal null
1) "before all" hook

  0 passing (3m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 200000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
  



child_process.js:615
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration android.emu.debug --loglevel verbose    --grep :ios: --invert  
    at checkExecSyncError (child_process.js:575:11)
    at Object.execSync (child_process.js:612:13)
    at runMocha (/Users/punchh_yogesh/Downloads/noodles/Noodles/node_modules/detox/local-cli/detox-test.js:105:6)
    at run (/Users/punchh_yogesh/Downloads/noodles/Noodles/node_modules/detox/local-cli/detox-test.js:66:7)
    at Object.<anonymous> (/Users/punchh_yogesh/Downloads/noodles/Noodles/node_modules/detox/local-cli/detox-test.js:56:1)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
@tachtevrenidis
Copy link

I get the exact same thing (trying to run on android emulator). The react native example project works fine on my mac, and I have gone to great lengths to match versions etc (I am at 0.51.1, detox 7.3.7, node 8.9.3).

My error looks like:

adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:50413 -e detoxSessionId 61b324d0-d0f8-2e39-1afb-e1347e89e1f5 -e debug false com.xxx.yyy.test/android.support.test.runner.AndroidJUnitRunner 
detox verb Instrumentation spawned, childProcess.pid:  33908
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.microsoft.itemsview.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.xxx.yyy.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_RESULT: shortMsg=Process crashed.
detox verb Instrumentation stdout:  INSTRUMENTATION_CODE: 0
detox verb Instrumentation stdout:  
detox verb instrumentationProcess terminated due to receipt of signal null 

The installed app seems to work, if I start it after I exit out of the detox test run.

The only thing that I consider relevant in logcat is:

06-02 14:14:32.818 14733 14733 W asset   : Asset path /data/app/com.xxx.yyy-1/split_lib_dependencies_apk.apk is neither a directory nor file (type=1).

@yogeshthanvi
Copy link
Author

Anyone Can help on this ? I am stuck with this issue

@tachtevrenidis
Copy link

if there are any other logs, I need to provide, let me know!

@rotemmiz
Copy link
Member

rotemmiz commented Jun 4, 2018

ADB logcat would probably have the needed data to understand your issue. Seems like the app crashes

@tachtevrenidis
Copy link

tachtevrenidis commented Jun 4, 2018

@rotemmiz ok will try to get that. Also the app seems to work, as I mentioned, if i just started it by tapping on it on the emulator (the app that got installed as part of detox test -c android.emu.debug).

Let me add this. When my app starts, the 'landing' screen is native (Android java) NOT an RN component. The launch of the RN component is on tap in from there. In iOS, it does not seem to matter as inside our Detox test, we grab the button to tap from the landing screen, simulate the tap (still inside the test), and then the RN component gets launched. Does that make a difference on Android?

@rotemmiz
Copy link
Member

rotemmiz commented Jun 4, 2018

Not sure I understand what "we grab the button to tap from the launch script, simulate the tap (still inside the test)" is, but having a hybrid app that initiates RN only at a later stage may cause sync issues on Android (pretty sure we already tackled that on iOS).
Can you provide a demo project that reproduces this error?

@tachtevrenidis
Copy link

I will try to get some time to generate a repo that produces this error. Sorry, I don't know why I typed 'launch script' :-) I edited the post. So we pretty much do a:

await expect(element(by.id('LaunchReactNativeComponent'))).toBeVisible();
await element(by.id('LaunchReactNativeComponent')).longPress();

LaunchReactNativeComponent is a native button (does not come from RN) and in iOS, at least, we set its accessibility id to 'LaunchReactNativeComponent' so we can reference it inside the detox test.

I hope this helps!

@rotemmiz
Copy link
Member

rotemmiz commented Jun 4, 2018

I still don't understand the issue. Does the app crash on tap?
Please provide logcat output

@yogeshthanvi
Copy link
Author

This issue is no longer exist from my side , I am closing down this issue

@tachtevrenidis
Copy link

@yogeshthanvi how did you fix it?

@tachtevrenidis
Copy link

@rotemmiz, I got logcat info for you:

detox log looks like this:

detox verb 9: /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop ro.build.version.sdk 
detox verb 9: stdout: 25
 
detox verb 10: /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/username/Development/blah/mobile/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk 
detox verb 10: stdout: Success
 
detox verb 11: /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.company.blah 
detox verb 12: /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell pm list instrumentation 
detox verb 12: stdout: instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
instrumentation:com.company.blah.test/android.support.test.runner.AndroidJUnitRunner (target=com.company.blah)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)
 
detox verb /Users/username/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:53836 -e detoxSessionId a8ea9529-c8d0-88ac-908a-f11ae42e1a39 -e debug false com.company.blah.test/android.support.test.runner.AndroidJUnitRunner 
detox verb Instrumentation spawned, childProcess.pid:  57266
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox wss 15:02:17: role=tester action=isReady (sessionId=a8ea9529-c8d0-88ac-908a-f11ae42e1a39)
detox wss 15:02:17: role=testee not connected, cannot fw action (sessionId=a8ea9529-c8d0-88ac-908a-f11ae42e1a39)
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.company.sample.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.company.sample.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_RESULT: shortMsg=Process crashed.
detox verb Instrumentation stdout:  INSTRUMENTATION_CODE: 0
detox verb Instrumentation stdout:  
detox verb instrumentationProcess terminated due to receipt of signal null 
  1) "before all" hook

  0 passing (8m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
  




  0 passing (8m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
  



detox wss 15:09:22: role=tester disconnect (sessionId=a8ea9529-c8d0-88ac-908a-f11ae42e1a39)
child_process.js:644
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration android.emu.debug --loglevel DEBUG    --grep :ios: --invert  
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at runMocha (/Users/username/Development/odsp-common-metro/common/temp/node_modules/.product.pkgs.visualstudio.com/detox/7.4.3/node_modules/detox/local-cli/detox-test.js:116:6)
    at run (/Users/username/Development/odsp-common-metro/common/temp/node_modules/.product.pkgs.visualstudio.com/detox/7.4.3/node_modules/detox/local-cli/detox-test.js:75:7)
    at Object.<anonymous> (/Users/username/Development/odsp-common-metro/common/temp/node_modules/.product.pkgs.visualstudio.com/detox/7.4.3/node_modules/detox/local-cli/detox-test.js:185:1)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

corresponding logcat right around the crash is:

06-26 15:19:34.150 21101-21132/com.company.app I/DetoxManager: DetoxServerUrl : ws://10.0.2.2:54886
    DetoxSessionId : 40e50196-8a07-56b2-6d40-c0580604bfef
06-26 15:19:34.194 21101-21101/com.company.app D/ReactNative: ReactInstanceManager.ctor()
06-26 15:19:34.228 1343-1343/? W/SurfaceFlinger: couldn't log to binary event log: overflow.
06-26 15:19:34.383 21101-21101/com.company.app D/ReactNative: ReactInstanceManager.createReactContextInBackground()
    ReactInstanceManager.recreateReactContextInBackgroundInner()
   
    --------- beginning of crash
06-26 15:19:34.417 21101-21136/com.company.app E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: com.company.app, PID: 21101
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:325)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: java.lang.InstantiationError: okhttp3.internal.ws.RealWebSocket
        at okhttp3.OkHttpClient.newWebSocket(OkHttpClient.java:414)
        at com.facebook.react.devsupport.InspectorPackagerConnection$Connection.connect(InspectorPackagerConnection.java:248)
        at com.facebook.react.devsupport.InspectorPackagerConnection.connect(InspectorPackagerConnection.java:49)
        at com.facebook.react.devsupport.DevServerHelper$3.doInBackground(DevServerHelper.java:225)
        at com.facebook.react.devsupport.DevServerHelper$3.doInBackground(DevServerHelper.java:217)
        at android.os.AsyncTask$2.call(AsyncTask.java:305)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
06-26 15:19:34.424 21101-21135/com.company.app I/Process: Sending signal. PID: 21101 SIG: 9
06-26 15:19:34.700 1750-1773/system_process E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 52)
06-26 15:19:35.101 12272-19919/com.google.android.gms.persistent E/WakeLock: release without a matched acquire!
06-26 15:19:35.367 1750-1750/system_process E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 80)

@rotemmiz
Copy link
Member

Are you running the correct Android flavour ? RN45 needs minReactNative44 flavour

@support
Copy link

support bot commented Jun 27, 2018

We use the issue tracker exclusively for bug reports and feature requests. This issue appears to be a general usage or support question. Instead, please ask a question on Stack Overflow with the detox tag.

@tachtevrenidis
Copy link

@rotemmiz,

I have this:

 testBuildType System.getProperty('testBuildType', 'debug')  //this will later be used to control the test apk build type
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        missingDimensionStrategy "minReactNative", "minReactNative44" //read note

in my app build file

@tachtevrenidis
Copy link

and when I do a detox build, I see this:

> Task :detox:compileMinReactNative44DebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :detox:compileMinReactNative46DebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FYI

@rotemmiz
Copy link
Member

I'm not sure what's the issue then, we moved past RN 45 a long time ago. If it's possible, try upgrading RN on your project and see if the error persists.

@tachtevrenidis
Copy link

I am on 0.55...

@tachtevrenidis
Copy link

Do I need to be on a specific Android SDK for the emulator that I point detox to?

@rotemmiz
Copy link
Member

No hard dependency, but try API lvl 27

@tachtevrenidis
Copy link

got it working! API lvl 27 was the culprit!

@rotemmiz
Copy link
Member

What did you use before?

@tachtevrenidis
Copy link

26

@tachtevrenidis
Copy link

my project is set to to 27 btw:

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.comp.product"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        testBuildType System.getProperty('testBuildType', 'debug')  //this will later be used to control the test apk build type
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        missingDimensionStrategy "minReactNative", "minReactNative46" //read note
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }

@tachtevrenidis
Copy link

oh I also changed to:

minReactNative46

@rotemmiz
Copy link
Member

So was it configured with the right flavour ?
What was the problem? API 26 emulator or detox flavour ?

@wix wix locked and limited conversation to collaborators Jul 23, 2018
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

3 participants