Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DomainSocket.read(Native Method) never timeout / hang for Docker Stop Container operation #1726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tyge68 opened this issue Oct 28, 2021 · 1 comment

Comments

@tyge68
Copy link
Contributor

tyge68 commented Oct 28, 2021

Currently I am using a library to run some selenium tests (1) , while trying to use that latest one which is based on docker-java 3.2.12, I am now facing an endless read issue during the docker container stop operation, which I originally reported on (3), but as this seems to belong to this code repository, I also decided to report it here.

The main stacktrace is following in the thread dump that is hanging
"main" #1 prio=5 os_prio=31 cpu=2693.71ms elapsed=27.41s tid=0x00007fabe3809000 nid=0x2703 runnable [0x000070000f5a6000]
java.lang.Thread.State: RUNNABLE
at com.github.dockerjava.transport.DomainSocket.read(Native Method)
at com.github.dockerjava.transport.DomainSocket.read(DomainSocket.java:79)
at com.github.dockerjava.transport.DomainSocket.access$200(DomainSocket.java:35)
at com.github.dockerjava.transport.DomainSocket$DomainSocketInputStream.read(DomainSocket.java:164)
at org.apache.hc.core5.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:149)
at org.apache.hc.core5.http.impl.io.BHttpConnectionBase.fillInputBuffer(BHttpConnectionBase.java:265)
at org.apache.hc.core5.http.impl.io.BHttpConnectionBase.isStale(BHttpConnectionBase.java:295)
at org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.isStale(DefaultBHttpClientConnection.java:67)
at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:287)

  • locked <0x000000061f37b6b0> (a org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1)
    at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.acquireEndpoint(InternalExecRuntime.java:109)
    at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:119)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:175)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:133)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
    at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:183)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
    at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
    at com.github.dockerjava.core.DefaultInvocationBuilder.post(DefaultInvocationBuilder.java:102)
    at com.github.dockerjava.core.exec.StopContainerCmdExec.execute(StopContainerCmdExec.java:33)
    at com.github.dockerjava.core.exec.StopContainerCmdExec.execute(StopContainerCmdExec.java:13)
    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
    at com.github.dockerjava.core.command.StopContainerCmdImpl.exec(StopContainerCmdImpl.java:63)
    at io.github.bonigarcia.wdm.docker.DockerService.stopContainer(DockerService.java:326)

It looks like known of the timeout that could exist in the different above layers are used.
The operating system which I run this code is a Mac OS 11.6 (Big Sur)

Before that I used the previous version of selenium-jupiter (4) without any issues which was based on docker-java 3.2.7

Environment:
Mac OS 11.6 (Big Sur)
Docker version 20.10.7, build f0df350
java version "11.0.8" 2020-07-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.8+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode)

(1) https://github.com/bonigarcia/selenium-jupiter
(2) https://github.com/bonigarcia/webdrivermanager/blob/master/pom.xml#L13
(3) bonigarcia/selenium-jupiter#200
(4) https://github.com/bonigarcia/selenium-jupiter/tree/selenium-jupiter-3.4.0

@tyge68
Copy link
Contributor Author

tyge68 commented Oct 28, 2021

Additional comment which I also made on the selenium-jupiter issues, I could stop the docker container "manually" with curl without any issues. So it means the command that it supposed to be executed by the com.github.dockerjava.core.command.StopContainerCmdImpl.exec is valid, so it is not really clear why it hang on the native read operation.

tyge68 added a commit to tyge68/docker-java that referenced this issue Oct 28, 2021
…alls

Avoiding checking for stale resolve the issue for me
@bsideup bsideup closed this as completed in c61da29 Nov 2, 2021
robobario added a commit to robobario/docker-java that referenced this issue Jul 21, 2023
Why:
We have been experiencing problems with podman and testcontainers using a
globally cached ZerodepDockerHttpClient. The problem is, with it's default configuration,
podman closes idle connections after 10 seconds. The apache HTTP client's default
connection keepalive is 3 minutes. So we are seeing exceptions thrown when the client
attempts to use these stale connections that it has in the connection pool.

A configuration that could help are reducing the connectionKeepAlive, so we could
configure the pool to close connections in line with this podman timeout.

Note: stale connection checking does not work and blocks in the isStale see docker-java#1726

testcontainers/testcontainers-java#7310
robobario added a commit to robobario/docker-java that referenced this issue Jul 15, 2024
Why:
We have been experiencing problems with podman and testcontainers using a
globally cached ZerodepDockerHttpClient. The problem is, with it's default configuration,
podman closes idle connections after 10 seconds. The apache HTTP client's default
connection keepalive is 3 minutes. So we are seeing exceptions thrown when the client
attempts to use these stale connections that it has in the connection pool.

A configuration that could help are reducing the connectionKeepAlive, so we could
configure the pool to close connections in line with this podman timeout.

Note: stale connection checking does not work and blocks in the isStale see docker-java#1726

testcontainers/testcontainers-java#7310
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant