-
Notifications
You must be signed in to change notification settings - Fork 351
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
Threads stuck when jersey client with apache connector is used concurrently #3772
Comments
|
Happens here also, and we don't use docker, just TestNG. We use TestNG to test our SDK which have multiple places it calls Jersey 2.x to perform various server access tasks. Once we added a new feature (which communicates with the server using We narrowed it down to one of the new This is the stacktrace:
|
P.S. Trying to upgrade to the latest version and even one before (2.26, 2.27) of Jersey failed with
|
since jersey 2.26 it is needed to add org.glassfish.jersey.inject:jersey-hk2 to the depenecies |
I tried that, it indeed solved the |
As I'm looking at this issue, it seems the problem lies beneath Jersey framework. Trying to reproduce the issue I tried described steps and it really hangs. However it hangs on waiting results of the completable feature. As per specification the get() method of the completable feature waits until the feature is completed. And it shall be completed as soon as the response is received. However response never comes. What says thread dump is that thread is waiting on SessionInputBufferImpl.streamRead (and some steps below). Which is correct. But response never comes. so feature never gets completed thus it looks like everything is hanged. Jersey layer is just a mediator here so it does not cause hanging it just waits for the feature completion as well. |
That is a valid point with waiting for completion of a call to an external service (in this case Docker daemon). However, it's strange that the example from reproduction steps works fine with versions of Jersey prior to 2.22.2. |
well yes, I can confirm that. The issue happens since Jersey 2.22.2. Further more I've localized the reason why it happens and will try to fix that. The issue is caused by wrapping of the response input stream together with response instance itself in attempt to close both stream and response (which does not seam to be a good idea). This causes hanging. |
Signed-off-by: Maxim Nesen <[email protected]>
This seems to be fixed by #3861 |
I've just tried the changes from #3861 and it is working correctly. |
#3861 is merged to 2.29. |
…operations see also: - eclipse-ee4j/jersey#3772 - zalando#808
…operations see also: - eclipse-ee4j/jersey#3772 - #808
…operations see also: - eclipse-ee4j/jersey#3772 - #808
Description
Using jersey client with apache connector from multiple threads concurrently results in threads that wait forever
How to reproduce
Run the following code
With this maven pom.xml
Expected result
"All done" is written in the console and (optionally, see notes below) the program finishes
Actual result
One of the threads gets stuck with the following thread dump output
Prerequisites
Notes
inspectContainer
call withinspectContainerReturnString
will make the program run as expected, without threads getting stuckfinal Client client = ClientBuilder.newBuilder().build();
and communicating with a dummy http server that returns over http the same responses that daemon would return over UNIX socketThe text was updated successfully, but these errors were encountered: