testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

mockserver container times out occasionally on Apple M1

Open jakub-id opened this issue 5 years ago • 8 comments

It happens intermittently, likely because the container is amd64 and doesn't seem to be updated any more:

17:12:29 INFO  GenericContainer     Container mockserver/mockserver:mockserver-5.11.2 is starting: be0a77a7048804b3001bcf475b90c6dae58f46d8561b864c8433f4e7a70e0efc
17:12:29 INFO  HttpWaitStrategy     /keen_elbakyan: Waiting for 60 seconds for URL: http://localhost:53161/mockserver/status (where port 53161 maps to container port 
1080)
17:13:29 ERROR GenericContainer     Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for URL to be accessible (http://localhost:53161/mockserver/status should return HTTP [200])
        at org.testcontainers.containers.wait.strategy.HttpWaitStrategy.waitUntilReady(HttpWaitStrategy.java:264) ~[testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:51) ~[testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929) ~[testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468) ~[testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331) ~[testcontainers-1.16.2.jar:?]
        at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) [duct-tape-1.0.8.jar:?]
        at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329) [testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317) [testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:1066) [testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29) [testcontainers-1.16.2.jar:?]
        at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30) [testcontainers-1.16.2.jar:?]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [junit-4.13.2.jar:4.13.2]
        at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30) [testcontainers-1.16.2.jar:?]
        at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.2.jar:4.13.2]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.2.jar:4.13.2]
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.2.jar:2.22.2]
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.2.jar:2.22.2]
17:13:29 ERROR GenericContainer     There are no stdout/stderr logs available for the failed container

jakub-id avatar Nov 24 '21 16:11 jakub-id

same problem with me with apple macbook air m1 laptop

nsarvar avatar Dec 30 '21 06:12 nsarvar

@skoczko Could you find any solution?

nsarvar avatar Dec 30 '21 09:12 nsarvar

No. The failure is non-deterministic and related to the poor reliability of the QEMU emulation. I think the only solution is for the testcontainers to provide a native aarch64 container.

jakub-id avatar Dec 30 '21 09:12 jakub-id

In my case, it is not working at all. Showing this error all the time.

nsarvar avatar Dec 30 '21 12:12 nsarvar

I think the only solution is for the testcontainers to provide a native aarch64 container.

FYI the images are provided by the technologies, not us. See https://github.com/mock-server/mockserver/issues/819 and consider sharing your feedback there 👍

bsideup avatar Dec 30 '21 13:12 bsideup

Same problem here with M1 Max

cyw233 avatar Feb 02 '22 23:02 cyw233

Also seeing this every time on an M1. Anyone seen any progress on this?

mattreedjbh avatar Feb 11 '22 19:02 mattreedjbh

Unfortunately there isn't anything we can do on the Testcontainers side. It is the container images that are failing, and some x86 do not play well with QEMU.

What you can do is:

  1. Add " 👍 " here: https://github.com/mock-server/mockserver/issues/819
  2. Maybe report to Docker that QEMU layer crashes (you don't need Testcontainers to reproduce that)

bsideup avatar Feb 11 '22 21:02 bsideup