Repository navigation
Closed
Labels
Description
Version 1.6.0
Not sure if this came from multiple threads but never seen it with single thread.
Many tests use several types of containers.
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
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.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Can not connect to Ryuk
at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:158)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:116)
at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:126)
at org.testcontainers.containers.JdbcDatabaseContainer.<init>(JdbcDatabaseContainer.java:35)
at org.testcontainers.containers.PostgreSQLContainer.<init>(PostgreSQLContainer.java:28)
at com.tests.container.DbContainer.<init>()
at com.tests.MyTest.<clinit>()
... 27 more
Reacted by Elliott Richerson, Danil Lopatin, Gilad Bar Orion, Simone Conte, Stuart Hendren, Lars Wiedenhoeft and btoo
Activity
bsideup commentedon Feb 2, 2018
Hi @alexcase52,
Could you please try with 1.5.1 + multiple threads? I want to make sure that this is a regression in 1.6.0 :)
llfbandit commentedon Feb 7, 2018
Hi @alexcase52,
I get also the error only on 1.6.0, 1.5.1 is fine.
Testing on Windows 10 with Java9.
Is deamon exposition on tcp://xy:2375 without TLS mandatory ?
kiview commentedon Feb 7, 2018
@llfbandit
This is currently still mandatory (until we will be able to support npipes or Docker for Windows will support Unix sockets).
llfbandit commentedon Feb 7, 2018
https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/
Well... kind of tiny scope for now...
alvarosanchez commentedon Apr 3, 2018
I'm experiencing a similar issue when running on Jenkins, with a
DOCKER_HOSTpointing to some other host:Downgrading to 1.5.1 fixes the issue.
reverting testContainers version to 1.5.1 from 1.6.0 due to issue in …
kiview commentedon May 14, 2018
@alvarosanchez
Thanks for the info, is
10.17.48.167the ip of yourDOCKER_HOST? Should be. Could this be a problem with a firewall?I assume unrelated, but I've experienced this problem when inside a network with a captive portal, so this can be some DNS hickup.
alvarosanchez commentedon May 14, 2018
Yes, it is.
No, because then version 1.5.1 wouldn't work either. Note that the client machine (a Jenkins instance) is able to run Docker commands on that
DOCKER_HOSTviadockerCLI and also the Gradle plugin.kiview commentedon May 14, 2018
@alvarosanchez
With version 1.6.0 we've introduced a new implementation for the
ResourceReapercomponent, which will now run outside of the JVM in its own Docker container (the container is calledRyukand the error appears when trying to connect to this container).Since we don't have an automated CI build for this scenario (remote
DOCKER_HOST), I'm not sure if this implementation broke the compatibility with some remote scenarios.I've changed the title of the issue to better reflect the current state of knowledge we have, I hope it's okay for everyone involved?
@alexcase52 Were you able to find out if this issue is related to multiple Gradle threads?
[-]Issue when running gradle tests in multiple threads[/-][+]Can't connect to Ryuk container when using remote Docker host[/+]kiview commentedon May 15, 2018
@alvarosanchez
Have you tried using 1.7.0? Maybe the container startup ran into a timeout as mentioned in #621.
bsideup commentedon May 15, 2018
@kiview 1.7.2 :)
lon-pilot-mpf commentedon May 23, 2018
Hi, Just encountered this on 1.7.3 running a test on our Jenkins server:
deshchenko commentedon May 24, 2018
Hi, I have similar error on 1.7.3 inside Jenkins image.
In docker processes I see that Ruak image has been started, but it impossible to connect to it for some Reason...
20 remaining items
StefanHufschmidt commentedon Feb 6, 2019
We ran into the same problem as well
We're using Testcontainers inside a custom JUnit-Rule which
This might not be the polite way to use Testcontainers but this replaced some legacy code and works much better than before.
We've started the tests several times, this error seems to occur in a non-deterministic way.
Using Testcontainers version 1.10.5.
ciri-cuervo commentedon Apr 15, 2019
have tried creating the docker group? it solves permission issues
mariusneo commentedon Apr 15, 2019
Please see #1274 . It is very likely that the local UNIX socket is not opened on your docker host.
Adding
-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375when running the docker server should solve your issue.skyline75489 commentedon Jun 18, 2019
Ryuk seems to be listening on random port(33088 and 33089 and so on). This is unacceptable when docker host is behind firewall. I can't open all the port only for Ryuk.
bsideup commentedon Jun 18, 2019
@skyline75489
It is not just Ryuk, but every container we start will be listening on a random port.
Wosin commentedon Jul 12, 2019
@bsideup
And is there any way to force Ryuk to bind on the specific port not the random one ? We are having the similar issues with docker-host behind the firewall.
bsideup commentedon Jul 12, 2019
@Wosin no, sorry. As I said - it is not just Ryuk, but any container we start.
errandir commentedon Sep 6, 2019
I've run into a similar problem but on localhost. After starting a docker container, the program hanged for two minutes trying to connect to it (only info log is saved, but there were requests every second in debug log). After that, while obtaining connection, it raised
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureCaused by: java.net.ConnectException: Connection refused (Connection refused)(stacktrace).Reboot solved the problem. I think that the reason for such behavior was a nearly full load of the RAM with enabled swap, that had an about quarter load.
vkopichenko commentedon Sep 9, 2019
If someone comes here having broken bitbucket pipeline with error
org.testcontainers.utility.ResourceReaper : Can not connect to Ryuk at localhost:32768 java.net.SocketException: Broken pipe (Write failed)then here is the solution:https://www.testcontainers.org/supported_docker_environment/continuous_integration/bitbucket_pipelines/
bsideup commentedon Nov 9, 2020
Closing as outdated, since the issue seemed to be caused by network misconfiguration (see #572 (comment) for an advice on how to fix it)
Try testcontainers/testcontainers-java#572 (comment)
Try testcontainers/testcontainers-java#572 (comment)
psadovsky commentedon Jan 5, 2025
What do you think about this variable TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal ? The source is here testcontainers configuration and this can be relevant for some people also https://github.com/testcontainers/testcontainers-java/blob/main/docs/supported_docker_environment/continuous_integration/dind_patterns.md