question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.RuntimeException: androidx.test.services.shellexecutor.ClientNotConnected

See original GitHub issue

Description

Instrumentation test randomly failing. When running espresso tests on our CI machine (which runs tests on Firebase Test Lab) we occasionally get the following crash and then the tests stop:

FATAL EXCEPTION: AndroidTestOrchestrator
Process: androidx.test.orchestrator, PID: 8463
java.lang.RuntimeException: androidx.test.services.shellexecutor.ClientNotConnected
	at androidx.test.services.shellexecutor.ShellExecutorImpl.executeShellCommandSync(ShellExecutorImpl.java:60)
	at androidx.test.orchestrator.AndroidTestOrchestrator.execShellCommandSync(AndroidTestOrchestrator.java:532)
	at androidx.test.orchestrator.AndroidTestOrchestrator.access$700(AndroidTestOrchestrator.java:127)
	at androidx.test.orchestrator.AndroidTestOrchestrator$2.run(AndroidTestOrchestrator.java:360)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
	at java.lang.Thread.run(Thread.java:818)
Caused by: androidx.test.services.shellexecutor.ClientNotConnected
	at androidx.test.services.shellexecutor.ShellCommandClient.execOnServer(ShellCommandClient.java:97)
	at androidx.test.services.shellexecutor.ShellCommandClient.execOnServerSync(ShellCommandClient.java:135)
	at androidx.test.services.shellexecutor.ShellExecutorImpl.executeShellCommandSync(ShellExecutorImpl.java:56)
	... 6 more

It’s never the same test causing the problem. Not sure it matters but it’s only when testing on Nexus5X emulator for API versions 23 / 24. Tests on other emulators / API versions all pass fine.

Steps to Reproduce

none

Expected Results

Tests should continue and complete

Actual Results

Crash.

AndroidX Test and Android OS Versions

 junitVersion = '4.12'
androidXJunitVersion = '1.1.1-alpha01'
androidXTestRunnerVersion = '1.1.2-alpha01'
androidXTestRulesVersion = '1.1.2-alpha01'
androidXTestOrchestratorVersion = '1.1.2-alpha01'
espressoCoreVersion = '3.1.2-alpha01'
espressoContribVersion = '3.1.2-alpha01'
espressoIdlingVersion = '3.1.2-alpha01'

Link to a public git repo demonstrating the problem:

none

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:17

github_iconTop GitHub Comments

4reactions
tasomaniaccommented, Apr 30, 2021

We also have this issue but we always had clearPackageData enabled like mentioned by @tobrun I’m not sure if that’s the cause.

Is there anything we can do to help proceed investigation of this issue?

2reactions
tir38commented, Jun 12, 2019

@athkalia this started happening on all of our test emulators (including API28). I think what was happening was that we were hitting the default 15 min timeout for Firebase Test Lab. Depending on how you trigger your tests you may need to increase the timeout

https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run#--timeout

When we bumped to 30 mins, everything was fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Test Orchestrator not working with Android X
from looking at the above: It seems like it is trying to execute this command with android support version as opposed to the...
Read more >
Class androidx.test.services.shellexecutor.ClientNotConnected
Likely thrown if the ShellCommandExecutor was never started. Summary. Constructors. public, ClientNotConnected(). Methods. from java.lang ...
Read more >
AndroidJUnitRunner - Android Developers
The test runner handles loading your test package and the app under test to a device, running your tests, and reporting test results....
Read more >
Android Test Orchestrator : Execution stopped on Process ...
Install orchestrator-1.0.1.apk and test-services-1.0.1.apk ... app_process / \android.support.test.services.shellexecutor. ... Cause: java.lang.
Read more >
Source Code for AndroidTestOrchestrator.java - AndroidX Tech
ClientNotConnected ; import androidx.test.services.shellexecutor. ... connectOrchestratorService(); } catch (RuntimeException e) { final String msg = "Fatal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found