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.

docker-maven-plugin hangs when waiting for log

See original GitHub issue

I configured mysql image to wait for log with a timeout. It was able to match the pattern from the log. However it got stuck cleaning up the connection afterwards.

Everything works if I remove the log wait.

  • d-m-p version : 0.21.0
  • Maven version: 3.3.9
  • Docker version : 17.03.1-ce-win12 (12058)

Pom:

                                <image>
                                    <name>mysql/mysql-server:5.7</name>

                                        <wait>
                                            <log>MySQL init process done. Ready for start up.</log>
                                            <time>60000</time>
                                        </wait>
                                    </run>
                                </image>

Maven log:

[DEBUG] Releasing connection 
[DEBUG] Connection can be kept alive indefinitely
[DEBUG] Cancelling request execution
[DEBUG] http-outgoing-4: Shutdown connection

Thread dump:

"main" #1 prio=5 os_prio=0 tid=0x000000000332e800 nid=0x26cc in Object.wait() [0x000000000315d000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at sun.nio.ch.NativeThreadSet.signalAndWait(NativeThreadSet.java:101)
	- locked <0x000000076f1f1c50> (a sun.nio.ch.NativeThreadSet)
	at sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:130)
	at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:115)
	- locked <0x000000076f1f1c40> (a java.lang.Object)
	at io.fabric8.maven.docker.access.hc.win.NamedPipe.close(NamedPipe.java:255)
	at org.apache.http.impl.BHttpConnectionBase.shutdown(BHttpConnectionBase.java:311)
	at org.apache.http.impl.conn.DefaultManagedHttpClientConnection.shutdown(DefaultManagedHttpClientConnection.java:97)
	at org.apache.http.impl.conn.LoggingManagedHttpClientConnection.shutdown(LoggingManagedHttpClientConnection.java:100)
	at org.apache.http.impl.execchain.ConnectionHolder.abortConnection(ConnectionHolder.java:127)
	- locked <0x000000076f1ea858> (a org.apache.http.impl.conn.LoggingManagedHttpClientConnection)
	at org.apache.http.impl.execchain.ConnectionHolder.cancel(ConnectionHolder.java:145)
	at org.apache.http.client.methods.AbstractExecutionAwareRequest.abort(AbstractExecutionAwareRequest.java:90)
	at io.fabric8.maven.docker.access.log.LogRequestor.finish(LogRequestor.java:228)
	- locked <0x000000076f0142d0> (a java.lang.Object)
	at io.fabric8.maven.docker.wait.LogWaitChecker.cleanUp(LogWaitChecker.java:49)
	at io.fabric8.maven.docker.wait.WaitUtil.cleanup(WaitUtil.java:80)
	at io.fabric8.maven.docker.wait.WaitUtil.wait(WaitUtil.java:64)
	at io.fabric8.maven.docker.service.WaitService.wait(WaitService.java:53)
	at io.fabric8.maven.docker.StartMojo$1.call(StartMojo.java:249)
	at io.fabric8.maven.docker.StartMojo$1.call(StartMojo.java:235)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:108)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:41)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:77)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:310)
	at java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
	at io.fabric8.maven.docker.StartMojo.startImage(StartMojo.java:235)
	at io.fabric8.maven.docker.StartMojo.executeInternal(StartMojo.java:132)
	- locked <0x000000076e96f3b8> (a io.fabric8.maven.docker.StartMojo)
	at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:223)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	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)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:25 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
cyChopcommented, Nov 6, 2018

@rhuss I seem to be stuck with a similar problem under Windows, with dmp 0.27.2 and Oracle JDK 8.171 (works fine in a jenkins-slim Docker container with OpenJDK 8.181).

The behaviour is the following:

. DMP starts the container . DMP finds the log ([INFO] DOCKER> Pattern '<my pattern>' matched for container 34100e85616e . DMP just waits, not finishing…

Windows 10 Java: Oracle JDK 8.171 Maven 3.5.3 DMP 0.27.2

3reactions
osteckecommented, Jan 12, 2020

The tip that @artnaseef posted gave me some direction into a workaround, yet unfortunately setting the environment variable didn’t do anything towards my Docker server. What did work is adding the following to the configuration of the docker-maven-plugin to my pom.xml:

<configuration>
	<dockerHost>tcp://localhost:2375</dockerHost>
</configuration>

Please do make sure that you enable the TCP daemon in the Docker for Windows settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker Maven Plugin hangs on start goal - Stack Overflow
I want to create an application with IT tests for Oracle DB. So far I am stuck on building the docker (it is...
Read more >
fabric8io/docker-maven-plugin
This is a Maven plugin for managing Docker images and containers. ... should wait until the given text pattern is matched in the...
Read more >
Docker Maven Plugin Introduction - Jose Carvajal
In this post, we'll see how we can use the Docker Maven plugin to start up third party services and how we can...
Read more >
Using Docker from Maven and Maven from Docker - Codefresh
Having a wait condition is one of the strongest points of the Fabric8 Docker plugin as it allows you to run integration tests...
Read more >
Running MockServer
MockServer is available in the following formats: java dependency · Docker container; Helm chart for Kubernetes; executable jar; Homebrew package; maven plugin ......
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