-
Notifications
You must be signed in to change notification settings - Fork 357
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
Connection timeout the double of what is configured #4742
Comments
Hello I am running your example in last Jersey and I am getting 2 in both tests:
I also tried my own test, and it behaves equal:
|
Hi @jbescos Have just reproduced on a fresh Ubuntu 20.04 cloud instance with both OpenJDK 8 and 11. Same issue as on my Mac with AdoptOpenJDK 8. In which environment are you trying to reproduce? Java 8:
For Java 11:
|
Just noticed the MessageBodyWriter error. Your example does not seem to produce content to post, so probably not triggering the specific issue. |
Thank you, I have modified it by Entity.text("example") and I can reproduce it. However the test is against http://stripe.reepay.com and we cannot see what is happening there. Maybe the server is spending some time. I have modified your test to run in localhost. You can copy paste the next class and put it in
The output says that it takes 1 second (the specified timeout):
|
Hi jbescos The modified test produces a read timeout, not a connection timeout. The issue is specifically regarding TCP connection timeout. stripe.reepay.com port 80 was used as there is no response on this port. It's a host we control. |
Thank you @oleborup, I have debugged this. There are 2 requests actually when the entity is not null. In org.glassfish.jersey.client.internal.HttpUrlConnector#_apply(368) there is one request that happens only if entity is not null. And later in sun.net.www.protocol.http.HttpURLConnection#_apply(374) in the catch, there is a handleException method that invokes java.net.HttpURLConnection#getResponseCode. This triggers again another connection. |
Introduced with Jersey 2.31 the client connection timeout is the double of the configured when posting an entity.
Small Spring Boot example project here: https://github.com/oleborup/jersey-client-connection-timeout
To reproduce
The text was updated successfully, but these errors were encountered: