Skip to content

Change mapping of connectionRequestTimeout to ConnPool leaseTimeout #1925

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

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

nichines
Copy link
Contributor

@nichines nichines commented Sep 9, 2021

Currently the RestClients.create() method sets the underlying RequestConfig connectTimeout and connectionRequestTimeout properties to the value of the ClientConfiguration connectTimeout property.

The connectionRequestTimeout is used as the leaseTimeout parameter when calling the AbstractNIOConnPool lease method, which can lead to a "TimeoutException: Connection lease request time out" on an establised connection.

The correct behavior is to use the sockerTimeout property for the leastTimeout parameter.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 9, 2021
@sothawo sothawo merged commit 3b8f0c9 into spring-projects:main Sep 10, 2021
@sothawo
Copy link
Collaborator

sothawo commented Sep 10, 2021

Thank you very much you for finding and fixing this.
Please create an issue first the next time before the PR.

Comment on lines 114 to +116
if (!timeout.isNegative()) {
requestConfigBuilder.setSocketTimeout(Math.toIntExact(timeout.toMillis()));
requestConfigBuilder.setConnectionRequestTimeout(Math.toIntExact(connectTimeout.toMillis()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just at a second look I saw that you moved the line into the if for the socketTimeout, but still using the configured value for the connectTimeout. Shouldn't do PRs in the morning before work. I'll fix that.

sothawo pushed a commit that referenced this pull request Sep 10, 2021
Original Pull Request: #1925
Closes: #1926

(cherry picked from commit 3b8f0c9)
sothawo pushed a commit that referenced this pull request Sep 10, 2021
Original Pull Request: #1925
Closes: #1926

(cherry picked from commit 3b8f0c9)
(cherry picked from commit 92806d2)
@sothawo sothawo linked an issue Sep 10, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change mapping of connectionRequestTimeout to ConnPool leaseTimeout
3 participants