Fix "docker-java-stream" thread stuck at UnixDomainSocket.recv()#1476
Conversation
docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/UnixDomainSocket.java
Outdated
Show resolved
Hide resolved
|
@bsideup is anything significant missing in the PR? Should I improve it? |
…ttp transport) (docker-java#1475) Prevent unnecessary recurring calls of `recv()` on UNIX socket, which sometimes results in blocking read and causes hanging of "docker-java-stream" thread.
…docker-java#1475) Prevent unnecessary recurring calls of `read()` on UNIX socket, which may result in blocking read and cause hanging of "docker-java-stream" thread.
e137293 to
f648421
Compare
|
I've extracted the changes for Due to different implementations of processing HTTP responses in OkHttp and HttpClient transport (different flows when working with the buffer — using |
…nnected or EOF is reached
|
@bsideup I believe that we (@prestosql) were hit by this bug after updating to testcontainers 1.15.0. Is there a chance that it will be merged soon and release will follow? |
|
@wendigo it is merged now and will be released soon. After that, we will update our version in TC and release it as well (since we shade docker-java (except |
|
@bsideup if you'd be able to release SNAPSHOT version of TC I can test if that solves our problem as well |
|
@bsideup can you comment back here when a new version has been released? Seeing similar issues and we think this might solve the problem. |
|
You can use jitpack.io to test the master branch: |
|
We have switched to the latest 3.2.6 version. So far so good. @bsideup thank you for the release! |
This version includes fix for "docker-java-stream" thread stuck at UnixDomainSocket.recv(): docker-java/docker-java#1476
This version includes fix for "docker-java-stream" thread stuck at UnixDomainSocket.recv(): docker-java/docker-java#1476
The fix is trivial and it is located in
com.github.dockerjava.okhttp.UnixDomainSocket.UnixSocketInputStream.read(byte[], int, int).I have also fixed
AttachContainerCmdIT, which used to fail for me from time to time because of the race condition. I believe the canonical way is to: (1) create the container, (2) attach to it, and then (3) start it. The last two actions have been previously shifted. This led to the race condition: the container might have finished its execution before the attach actually happened.For me (with Docker for Mac 2.4.0.0), the issue is reproduced in
com.github.dockerjava.cmd.AttachContainerCmdIT.attachContainerWithTTYtest for OkHttp transport:Sporadically in
masterbranch.Steadily after applying the PR Fix sporadic failures of AttachContainerCmdIT tests #1483 with the patch for
AttachContainerCmdIT:The
mainthread waits forAttachContainerTestCallbackto complete.And
docker-java-streamthread is stuck onrecv()when trying to process HTTP response headers ofattachcommand (while it should read the standard streams of the Docker container):