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

Add parameter to configure number of threads used in device operations #304

Merged
merged 1 commit into from Mar 19, 2014

Conversation

royclarkson
Copy link
Contributor

Some platforms may not be able to support a large number of concurrent
device operations. Set 'android.deviceThreads' to limit the number
threads available in the thread pool. By default the thread pool size
is based on the number of attached devices.

I consistently experience a java.io.IOException when attempting to deploy and test on more than four attached devices. This is any combination of physical devices and emulators. If there are more than four devices reported by the Android Debug Bridge, then the parallel execution of device functions will fail with the following exception. I've tested on three different macs running various versions of Java. Unfortunately, I don't have a windows or linux machine available for testing.

    Install of test.apk failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: 20080411413fc082_Contel_TAB-730 :   Install of /Users/rclarkson/Projects/spring-projects/spring-android/test/spring-android-core-test/target/spring-android-core-test.apk failed.
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:654)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$2.runDo(AbstractAndroidMojo.java:763)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$DoThread.run(AbstractAndroidMojo.java:1324)
Caused by: com.android.ddmlib.InstallException: Broken pipe
    at com.android.ddmlib.Device.installPackage(Device.java:880)
    at com.jayway.maven.plugins.android.AbstractAndroidMojo$1.doWithDevice(AbstractAndroidMojo.java:641)
    ... 2 more
Caused by: java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
    at com.android.ddmlib.AdbHelper.write(AdbHelper.java:731)
    at com.android.ddmlib.AdbHelper.write(AdbHelper.java:709)
    at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:770)
    at com.android.ddmlib.SyncService.openSync(SyncService.java:168)
    at com.android.ddmlib.Device.getSyncService(Device.java:514)
    at com.android.ddmlib.Device.syncPackageToDevice(Device.java:901)
    at com.android.ddmlib.Device.installPackage(Device.java:875)
    ... 3 more

Some platforms may not be able to support a large number of concurrent
device operations. Set 'android.deviceThreads' to limit the number
threads available in the thread pool. By default the thread pool size
is based on the number of attached devices.
@SierraGolf
Copy link
Contributor

I also ran into this issue. We were running 6 devices on a mac-mini with osx and experienced very frequent "broken pipes". We then switched to another mac-mini running ubuntu and the frequency of this exception reduced but it still happens from time to time.

@mosabua
Copy link
Member

mosabua commented Mar 19, 2014

Thanks. Looks good. I expect you both to test this once its all merged ;-)

mosabua added a commit that referenced this pull request Mar 19, 2014
Add parameter to configure number of threads used in device operations
@mosabua mosabua merged commit 50c46ad into simpligility:master Mar 19, 2014
@royclarkson royclarkson deleted the deviceThreads branch March 19, 2014 13:52
@royclarkson
Copy link
Contributor Author

@mosabua thanks! will do.

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

Successfully merging this pull request may close these issues.

None yet

3 participants