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
Fix deadlock waiting on docker log pattern to match #965
Conversation
…ed in 0.24.0 Apache HTTP Client will drain an http request upon closing the input stream. In this case we consume the docker logs in 'follow' mode which will cause the docker daemon to never close the connection on its end. Thus the close() call will block forever. The main thread is responsible for calling request.abort() will will signal Apache HTTP Client to close the socket on it's end and thus the close() call can unblock.
Codecov Report
@@ Coverage Diff @@
## master #965 +/- ##
============================================
+ Coverage 51.57% 51.58% +<.01%
Complexity 1232 1232
============================================
Files 144 144
Lines 7251 7243 -8
Branches 981 980 -1
============================================
- Hits 3740 3736 -4
+ Misses 3195 3191 -4
Partials 316 316
|
@rkhmelichek sorry, for the delay. I'm just on the road, but hopefully will have a look to the PR later on. My plan is to get to it before this weekend, please ping me again, if I dont make it. |
This also fixes #947 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot for the PR and the analysis, looks perfectly fine for me. Sorry for the long delay, but I nearly forgot this (very important) PR.
I'm going to cut a release this evening or tomorrow morning.
Great, thanks for all your work on this awesome maven plugin! |
thanks ;-) fyi, 0.25.0 has just been released, should bubble up to Maven central very soon. |
This fixes a regression introduced in the 0.24.0 version of the plugin.
I have a small test program to demonstrate the problem below.
Normally, Apache HTTP Client will drain an http request upon closing the input stream.
In this case we consume the docker logs in 'follow' mode which will cause the docker daemon to never close the connection on its end.
Thus the http client
close()
call will block forever.The main thread is responsible for calling
request.abort()
, which will signal Apache HTTP Client to close the socket on it's end and thus theclose()
call can unblock.Due to the refactoring in 0.24.0, there is a deadlock on this object in LogRequestor.java
Since the log requestor thread is waiting on
close()
and the main thread cannot reach the code to callrequest.abort()
I believe this is the same issue as #767 .
In the patch, I removed the lock completely, as I made sure that
request.abort()
is only called from the main thread. It doesn't seem necessary anymore.I have been testing my build of the plugin for a few days and it's been working on Docker for Mac and on our Linux build boxes.
I have briefly tested on Docker for Windows and seems to work as well...but I will run some more tests there.