Fix sporadic failures of AttachContainerCmdIT tests#1483
Conversation
|
What's interesting is that, despite it working, the docs suggest that the container should be running: But the tests are passing, so I think this is just some (outdated?) issue with the docs. Another thing is that, if we attach before starting, |
…t in "attachContainerWithStdin" test
…chContainerWithTTY" test
@bsideup after playing with |
Done! Please take a look at the two latest commits. |
|
@tejksat great! Thanks for verifying 💯 |
|
Yay!:) Thank you! |
Fix
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.Please note that the test
com.github.dockerjava.cmd.AttachContainerCmdIT.attachContainerWithTTYmight fail now with the exception:This happens because
docker-java-stream-...worker thread is stuck onrecv()system call while receiving HTTP headers response forattachrequest to the container:There is the PR with the fix for it #1476.