DaemonConnectionException thrown when running tests


#1

CI succeeds and fails randomly.
I’ve read topic below and tried some solutions, but it’s still unstable.
Would you help me?

Topic

Solutions

circle.yml

environment:
    ADB_INSTALL_TIMEOUT: 60

build.gradle

android {
    adbOptions {
        timeOutInMs 60 * 1000
    }
}

Errorlog when CI fails

Unable to install /path_to_apk/android_app.apk
com.android.ddmlib.InstallException
	at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:96)
	at com.android.ddmlib.Device.installPackages(Device.java:901)
	at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:119)
	at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:131)
	at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.android.ddmlib.ShellCommandUnresponsiveException
	at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:504)
	at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:382)
	at com.android.ddmlib.Device.executeShellCommand(Device.java:615)
	at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:82)
	... 10 more


com.android.builder.testing.ConnectedDevice > runTests[circleci-android22(AVD) - 5.1] FAILED 
	com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException
		at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:129)

FAILURE: Build failed with an exception.

* What went wrong:
Could not receive a message from the daemon.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.launcher.daemon.client.DaemonConnectionException: Could not receive a message from the daemon.
	at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:85)
	at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:35)
	at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:194)
	at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:162)
	at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:125)
	at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:80)
	at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
	at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
	at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
	at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
	at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
	at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
	at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
	at org.gradle.launcher.Main.doAction(Main.java:33)
	at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
	at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: org.gradle.messaging.remote.internal.MessageIOException: Could not read message from '/127.0.0.1:60998'.
	at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:84)
	at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:79)
	... 31 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 441824A5
	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
	at java.io.ObjectInputStream.(ObjectInputStream.java:299)
	at org.gradle.internal.io.ClassLoaderObjectInputStream.(ClassLoaderObjectInputStream.java:27)
	at org.gradle.messaging.remote.internal.Message$ExceptionReplacingObjectInputStream.(Message.java:208)
	at org.gradle.messaging.remote.internal.Message.receive(Message.java:56)
	at org.gradle.internal.serialize.BaseSerializerFactory$ThrowableSerializer.read(BaseSerializerFactory.java:148)
	at org.gradle.internal.serialize.BaseSerializerFactory$ThrowableSerializer.read(BaseSerializerFactory.java:146)
	at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$LogEventSerializer.read(DaemonMessageSerializer.java:204)
	at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$LogEventSerializer.read(DaemonMessageSerializer.java:180)
	at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:85)
	at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$OutputMessageSerializer.read(DaemonMessageSerializer.java:292)
	at org.gradle.launcher.daemon.protocol.DaemonMessageSerializer$OutputMessageSerializer.read(DaemonMessageSerializer.java:278)
	at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:85)
	at org.gradle.internal.serialize.Serializers$StatefulSerializerAdapter$1.read(Serializers.java:36)
	at org.gradle.messaging.remote.internal.inet.SocketConnection.receive(SocketConnection.java:77)
	... 32 more

./gradlew --console=plain --stacktrace connectedDebugAndroidTest -Pcom.android.build.threadPoolSize=1 -PdisablePreDex returned exit code 1

#2

Can you try upgrading to our 14.04 image for this project. You can change the build image via the menu in Project settings > Build environment.


#3

Can you try upgrading to our 14.04 image for this project. You can change the build image via the menu in Project settings > Build environment.

Thank you very much.
I tried it but it didn’t solve my problem.

Do you have other ideas?


#4

Finally, I’m very sorry because my problem, this problem, cannot be solved.

My problem is build-error on CircleCI.

  • I’ve updated my build-plan to 4x plan, for technical support.
  • Though I wrote 10 round-trips of mail, it cannot be solved.
  • I asked CircleCI to survey specifically because my problem cannot occur on my and my colleague’s PC.
  • CircleCI answered me “Sadly this issue looks to be specific to your project and we are not able to help dig into that.”
  • CircleCI closed my request and give up solving my problem.

I’m very sorry.


#5