Skip to content

Conversation

@LichKing-lee
Copy link
Contributor

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:

  • responseTimeout overrides socketTimeout for the duration of a request.
  • socketTimeout serves as the default unless overridden.

@LichKing-lee LichKing-lee force-pushed the improve-javadoc-for-timeout branch 2 times, most recently from 952cbb6 to f599f76 Compare August 24, 2025 23:08
@LichKing-lee LichKing-lee force-pushed the improve-javadoc-for-timeout branch from f599f76 to caa748a Compare August 24, 2025 23:09
* 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
Copy link
Member

@ok2c ok2c Aug 25, 2025

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
Copy link
Member

@ok2c ok2c Aug 25, 2025

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.

@ok2c
Copy link
Member

ok2c commented Sep 15, 2025

@LichKing-lee I committed your changes as 67f56a2 with some minor changes. Thank you for contributing this improvement.

@ok2c ok2c closed this Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants