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.

`JVMHookResourceReaper` fails in Quarkus continuous testing for multi module project

See original GitHub issue

When running Quarkus continuous testing in a multi-module project, something like the following is logged when terminating via ctrl+c:

Exception in thread "Thread-368" com.github.dockerjava.api.exception.ConflictException: Status 409: {"message":"a prune operation is already running"}

        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:245)
        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:33)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:13)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.PruneCmdImpl.exec(PruneCmdImpl.java:100)
        at org.testcontainers.utility.JVMHookResourceReaper.prune(JVMHookResourceReaper.java:53)
        at org.testcontainers.utility.JVMHookResourceReaper.lambda$performCleanup$3(JVMHookResourceReaper.java:28)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testcontainers.utility.JVMHookResourceReaper.performCleanup(JVMHookResourceReaper.java:28)
        at java.base/java.lang.Thread.run(Thread.java:833)
Exception in thread "Thread-76" com.github.dockerjava.api.exception.ConflictException: Status 409: {"message":"a prune operation is already running"}

        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:245)
        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:33)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:13)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.PruneCmdImpl.exec(PruneCmdImpl.java:100)
        at org.testcontainers.utility.JVMHookResourceReaper.prune(JVMHookResourceReaper.java:53)
        at org.testcontainers.utility.JVMHookResourceReaper.lambda$performCleanup$3(JVMHookResourceReaper.java:28)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testcontainers.utility.JVMHookResourceReaper.performCleanup(JVMHookResourceReaper.java:28)
        at java.base/java.lang.Thread.run(Thread.java:833)
Exception in thread "Thread-113" com.github.dockerjava.api.exception.ConflictException: Status 409: {"message":"a prune operation is already running"}

        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:245)
        at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:124)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:33)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.PruneCmdExec.execute(PruneCmdExec.java:13)
        at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
        at org.testcontainers.shaded.com.github.dockerjava.core.command.PruneCmdImpl.exec(PruneCmdImpl.java:100)
        at org.testcontainers.utility.JVMHookResourceReaper.prune(JVMHookResourceReaper.java:53)
        at org.testcontainers.utility.JVMHookResourceReaper.lambda$performCleanup$3(JVMHookResourceReaper.java:28)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testcontainers.utility.JVMHookResourceReaper.performCleanup(JVMHookResourceReaper.java:28)
        at java.base/java.lang.Thread.run(Thread.java:833)

I’m short on time currently, but I know the internals a bit and I suppose this is due to testcontainers (org.testcontainers.utility.ResourceReaper.DEATH_NOTE respectively) being loaded multiple times by mutliple classloaders. So each shutdown hook might be thinking it’s alone in the current JVM, but it isn’t, hence all run concurrently.

This of course only happens if TESTCONTAINERS_RYUK_DISABLED is true, but I want TC to be as fast as possible to provide a reusable(!) MariaDB container and I found the RYUK setup to waste a measurable amount of time. I don’t need/want any kind of cleanup by TC.

I see two options:

  • provide a env/system property to opt out of the shutdown hook(s)
  • and/or possibly don’t register any cleanup in case all containers involved are reusable/reused

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
famodcommented, Apr 27, 2022

Ok, so this isssue here will only affect people that have non-reusable containers (or just don’t have resuse activated?) and disable ryuk via TESTCONTAINERS_RYUK_DISABLED. Not having reuse enabled is probably very common, but having disabled ryuk is probably rare (?).

In my case, removing TESTCONTAINERS_RYUK_DISABLED is the way to go! 👍

1reaction
kiviewcommented, Apr 27, 2022

@famod You are right, that is the intention behind #4938, to provide better startup performance in those cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Continuous Testing - Quarkus
Note that continuous testing supports multi-module projects, so tests in modules other than the application can still be run when files are changed....
Read more >
Failed to start Quarkus in dev mode for multi module project
The solution is to move the configuration of the Maven plugin quarkus-maven-plugin to the section pluginManagement of the parent's pom.xml .
Read more >
Continuous testing failure - Google Groups
I have a test which needs to read all files from src/main/resources and the test works fine with mvn test. Continuous testing however...
Read more >
Project 'quarkusio_quarkus' can't have 2 modules with the ...
Hi, I'm trying to set up Sonarcloud for the Quarkus project and things are not working very well: Error: Failed to execute goal ......
Read more >
Camel Quarkus 2.4.0 Released
Hibernate Reactive 1.0.0.Final; Introducing Kafka Streams DevUI; Support continuous testing for multi module projects; Support AWT image resize ...
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