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.

Use connect timeout for Named Pipes

See original GitHub issue

At least on Windows, the plugin frequently logs retry attempts when connecting to the docker host via named pipes:

[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[INFO] I/O exception (java.io.FileNotFoundException) caught when processing request to {}->npipe://127.0.0.1:1: \\.\pipe\docker_engine (all pipe instances are busy)
[INFO] Retrying request to {}->npipe://127.0.0.1:1
[ERROR] DOCKER> Cannot create docker access object  [Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy)]

The build then fails with this exception:

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.25.2:start (start) on project geo-persistence: Cannot create docker access object: Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.25.2:start (start) on project geo-persistence: Cannot create docker access object 
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	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:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	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:498)
	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)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot create docker access object 
	at io.fabric8.maven.docker.service.DockerAccessFactory.createDockerAccess(DockerAccessFactory.java:52)
	at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:219)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 21 more
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Cannot extract API version from server npipe://127.0.0.1:1 : \\.\pipe\docker_engine (all pipe instances are busy)
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:105)
	at io.fabric8.maven.docker.service.DockerAccessFactory.createDockerAccess(DockerAccessFactory.java:45)
	... 24 more
Caused by: java.io.FileNotFoundException: \\.\pipe\docker_engine (all pipe instances are busy)
	at java.io.RandomAccessFile.open0(Native Method)
	at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:124)
	at io.fabric8.maven.docker.access.hc.win.NamedPipe.connect(NamedPipe.java:59)
	at io.fabric8.maven.docker.access.hc.util.AbstractNativeSocketFactory.connectSocket(AbstractNativeSocketFactory.java:42)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
	at org.apache.http.impl.conn.BasicHttpClientConnectionManager.connect(BasicHttpClientConnectionManager.java:323)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
	at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.get(ApacheHttpClientDelegate.java:67)
	at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.getServerApiVersion(DockerAccessWithHcClient.java:101)
	... 25 more

In my case, this happens when a build execution is directly followed by a start execution.

The connect timeout that is passed to io.fabric8.maven.docker.access.hc.win.NamedPipe#connect(java.net.SocketAddress, int) is 0. Apart from that, the parameter is not even used here. So the retries carried out by the Apache HttpClient happen instantly and show no effect. In contrast, if I wait 10-20 seconds and execute the plugin again, it usually works. So I guess this would just require some waiting time in between retries in order to work.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:14

github_iconTop GitHub Comments

3reactions
mcapacchcommented, Feb 11, 2019

this did the trick for us in the configuration section: <dockerHost>tcp://localhost:2375</dockerHost> (note tcp instead of http as my docker exposes its proper daemon)

2reactions
rhusscommented, Dec 12, 2018

Sprry, I’m really not a Windows expert. I wonder whether there is a limitation how many parallel request can be performed on NamedPipe (which is used to access the Windows Docker daemon).

Any Window expert out there able to help in fixing this issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NamedPipeClientStream.Connect Method (System.IO.Pipes)
Connects to a waiting server within the specified timeout period. ... a method to send a string from a parent process to a...
Read more >
Named Pipes server, how to interrupt or timeout the wait for ...
When the pipe handle is specified in the ReadFile, WriteFile, or ConnectNamedPipe function, the operations are not completed until there is data ...
Read more >
Connection Timeout with Named Pipes - SQLServerCentral
My issue is when we attempt to connect to the db using either our application or SQL Management studio, we have to explicitely...
Read more >
Timeout on Named Pipes | memset's blog
2 – ERROR_IO_PENDING: we are waiting the client's connection: we can wait PIPE_TIMEOUT_CONNECT ms (10 seconds) using the WaitForSingleObject() ( ...
Read more >
Could not open a connection to SQL Server [5]" when testing ...
"Login timeout expired ... Named Pipes Provider: Could not open a connection to SQL Server [5]" when testing database connection ...
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