-
Notifications
You must be signed in to change notification settings - Fork 983
Clarify Javadoc for responseTimeout and socketTimeout interaction #712
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
Clarify Javadoc for responseTimeout and socketTimeout interaction #712
Conversation
httpclient5/src/main/java/org/apache/hc/client5/http/config/ConnectionConfig.java
Show resolved
Hide resolved
httpclient5/src/main/java/org/apache/hc/client5/http/config/ConnectionConfig.java
Outdated
Show resolved
Hide resolved
httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java
Outdated
Show resolved
Hide resolved
httpclient5/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java
Outdated
Show resolved
Hide resolved
952cbb6 to
f599f76
Compare
f599f76 to
caa748a
Compare
| * connections created by this configuration. | ||
| * A timeout value of zero is interpreted as an infinite timeout. | ||
| * <p> | ||
| * This value acts as a baseline configured by the I/O layer. It can be |
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.
@LichKing-lee Actually this is not quite correct. The baseline is established by the respective i/o layer (through SocketConfig for the classic one or IOReactorConfig for the async one). Those settings apply to all newly created connections / channels indiscriminately. ConnectionConfig is one layer up and can apply selectively to specific hosts. This is reason ConnectionConfig exists, so one could configure different connection settings for specific hosts only.
| * </p> | ||
| * <p> | ||
| * This parameter may override a socket timeout configured at the connection | ||
| * or I/O layers for the duration of a message execution. It is not a hard |
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.
@LichKing-lee Not quite. It does not apply to the entire duration of a message exchange. It defines the maximum period of inactivity between sending of a request message and receipt of a response message head. Once a response head has been received the connection socket timeout gets reset back to its previous value and the content of the response message gets consumed with the socket timeout configured at the connection or i/o layers.
|
@LichKing-lee I committed your changes as 67f56a2 with some minor changes. Thank you for contributing this improvement. |
What problem does this solve?
The Javadoc for responseTimeout and socketTimeout does not clearly describe their interaction. Many users assume they are independent, but in classic I/O responseTimeout actually overrides the connection’s socketTimeout during request execution. This can cause confusion when diagnosing timeout behavior.
What does this PR do?
This PR updates the Javadoc of both RequestConfig#setResponseTimeout and ConnectionConfig#setSocketTimeout to explicitly document that behavior: