-
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
Change JettyConnector 'readTimeout' behavior to match socket read tim… #5114
Conversation
…eout definition - e.g., ApacheConnector behavior matches it. * Read timeout: Time on waiting to receive the first data byte. The `timeout` method timeouts the request even if data were already received, capping the query to a maximum execution time. This behavior is problematic when streaming data over a prolonged duration; the client has already received data bytes, but data continues to flow. I provided a jetty specific property (jersey.config.jetty.client.totalTimeout) that configures the 'totalTimeout' when required.
@@ -314,8 +314,14 @@ private Request translateRequest(final ClientRequest clientRequest) { | |||
request.followRedirects(clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true)); | |||
final Object readTimeout = clientRequest.resolveProperty(ClientProperties.READ_TIMEOUT, -1); | |||
if (readTimeout != null && readTimeout instanceof Integer && (Integer) readTimeout > 0) { | |||
request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS); | |||
request.idleTimeout((Integer) readTimeout, TimeUnit.MILLISECONDS); |
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.
Javadoc does not say much about this, but I think this does not exactly have the same meaning than read time out. This method should also have impact in writing (not only read).
However there is no such method to set a read timeout, and this is more correct than before, so it looks good to me.
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.
Javadoc does not say much about this, but I think this does not exactly have the same meaning than read time out. > This method should also have impact in writing (not only read).
You are right. the timeout may fire when there is a long enough pause during data transfer. I don't know to be honest.
As you say, the situation seems better like this anyway.
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.
LGTM
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.
Looks ok. The "idleTimeout" does not seem to be exactly the same as "readTimeout", but the behaviour looks similar.
…eout definition - e.g., ApacheConnector behavior matches it.
The
timeout
method timeouts the request even if data were already received, capping the query to a maximum execution time.This behavior is problematic when streaming data over a prolonged duration; the client has already received data bytes, but data continues to flow.
I provided a jetty specific property (jersey.config.jetty.client.totalTimeout) that configures the 'totalTimeout' when required.