joelittlejohn / embedmongo-maven-plugin

Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
Apache License 2.0
88 stars 51 forks source link

Socket Timeout Exception when trying to download embedded mongo #34

Closed sachaigh closed 10 years ago

sachaigh commented 10 years ago

Hello all,

I've been getting a timeout issue when running a maven install everytime it tries to install embedded mongo db.

[INFO] --- embedmongo-maven-plugin:0.1.9:start (start) @ unity-platform ---
Oct 31, 2013 4:52:18 PM de.flapdoodle.embed.process.store.ArtifactStoreBuilder build
SEVERE: Build ArtifactStore(useCache:true)
[WARNING] Unrecognised MongoDB version '2.4.4', this might be a new version that we don't yet know about. Attemping download anyway...
Download GenericVersion{2.4.4}:Windows:B64 START
Download GenericVersion{2.4.4}:Windows:B64 DownloadSize: 106026199
Download GenericVersion{2.4.4}:Windows:B64 0% 1% 2% Oct 31, 2013 4:52:31 PM de.flapdoodle.embed.process.runtime.Starter prepare
SEVERE: start
java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at sun.net.www.MeteredStream.read(MeteredStream.java:134)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3052)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at de.flapdoodle.embed.process.store.Downloader.download(Downloader.java:87)
        at de.flapdoodle.embed.process.store.ArtifactStore.checkDistribution(ArtifactStore.java:53)
        at de.flapdoodle.embed.process.store.CachingArtifactStore.checkDistribution(CachingArtifactStore.java:54)
        at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:55)
        at com.github.joelittlejohn.embedmongo.StartEmbeddedMongoMojo.execute(StartEmbeddedMongoMojo.java:212)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        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:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

I am on a windows 7 machine, and the firewall is turned off. I have tried running with -Dembedmongo.bindIp=127.0.0.1, but this doesn't make a difference.

Does anyone have any ideas? I've seen some similar issues reported, but I haven't managed to sort this out on my machine.

Thanks Stuart

joelittlejohn commented 10 years ago

It looks like the plugin is unable to download Mongo. As far as I can tell the MongoDB download server seems to be working fine, so I guess this is a problem that's local to you.

Do you need to use proxy to reach the internet?

sachaigh commented 10 years ago

Yeah, its a strange issue - the percentage completion it reaches before timing out is different each time I try to install. Don't need a proxy to access the internet, and this is working on other machines in the office.

joelittlejohn commented 10 years ago

I don't think there's anything we can look at in the plugin to diagnose this I'm afraid. As you say, this is working from your other machines, and there's certainly nothing going on in the plugin that would make this download abort part way through.

This sounds like some issue with the network stack on this specific machine.

dhanasekaran-anbalagan commented 10 years ago

I am getting Error Linux (ubuntu -64bit 12.04) as well

Detect Distribution DONE
Download Version{2.0.4}:Linux:B64 START
Download Version{2.0.4}:Linux:B64 DownloadSize: 38407218
Download Version{2.0.4}:Linux:B64 0% 1% 2% 3% 4% 5% 6% 7% 8% 9% 10% 11% 12% 13% 14% 15% 16% 17% 18% 19% 20% 21% 22% 23% 24% 25% 26% 27% 28% 29% 30% 31% 32% 33% 34% 35% 36% 37% 38% 39% 40% 41% 42% 43% 44% 45% 46% 47% 48% 49% 50% 51% 52% 53% 54% 55% 56% 57% 58% 59% 60% 61% 62% 63% 64% 65% 66% 67% 68% 69% 70% 71% 72% 73% 74% 75% 76% 77% 78% 79% 80% 81% 82% 83% 84% 85% 86% 87% 88% 89% 90% 91% 92% 93% 94% 95% 96% 97% 98% May 12, 2014 8:00:50 AM de.flapdoodle.embed.process.runtime.Starter prepare
SEVERE: start
java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:150)
    at java.net.SocketInputStream.read(SocketInputStream.java:121)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at sun.net.www.MeteredStream.read(MeteredStream.java:134)
    at java.io.FilterInputStream.read(FilterInputStream.java:133)
    at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3052)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    at java.io.FilterInputStream.read(FilterInputStream.java:107)
    at de.flapdoodle.embed.process.store.Downloader.download(Downloader.java:87)
    at de.flapdoodle.embed.process.runtime.Starter.checkDistribution(Starter.java:56)
    at de.flapdoodle.embed.mongo.MongodStarter.checkDistribution(MongodStarter.java:56)
    at de.flapdoodle.embed.process.runtime.Starter.prepare(Starter.java:68)
    at com.github.joelittlejohn.embedmongo.StartEmbeddedMongoMojo.execute(StartEmbeddedMongoMojo.java:141)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    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)
joelittlejohn commented 10 years ago

@dhanasekaran-anbalagan have you ever completed a successful download? When you reach 98% downloaded, do you then find that the system hangs for a long time before the timeout occurs? I wonder if the MongoDB download server is having problems which is causing your download to sit idle and incomplete for too long (triggering a timeout).

Unfortunately I don't think there's anything we can do inside this plugin to solve the problem - if the download times-out this is a failure either of your connectivity or the MongoDB download server.

I wonder though if we should make the timeout configurable as this seems to be possible looking at the code here:

https://github.com/flapdoodle-oss/de.flapdoodle.embed.process/blob/de.flapdoodle.embed.process-1.35/src/main/java/de/flapdoodle/embed/process/store/Downloader.java