Skip to content

Connection timeout in HttpComponents5MessageSender is not respected #1436

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

Closed
phuc98ute opened this issue Oct 16, 2024 · 1 comment · Fixed by #1437
Closed

Connection timeout in HttpComponents5MessageSender is not respected #1436

phuc98ute opened this issue Oct 16, 2024 · 1 comment · Fixed by #1437
Assignees
Labels
type: bug A general bug
Milestone

Comments

@phuc98ute
Copy link

phuc98ute commented Oct 16, 2024

Hi team,
I am trying to use a new class HttpComponents5MessageSender instead old class HttpComponentsMessageSender this have the same 2 functions: setConnectionTimeout and setReadTimeout

I debugged in the logic code and found that the connection timeout from new class HttpComponents5MessageSender will passed to HttpComponents5ClientFactory. And based on the HttpComponents5ClientFactory doc page, the function setConnectionTimeout should be "Sets the timeout until a connection is established."
image

However, when dig dive into the logic code, I found that the first logic implement for HttpComponents5ClientFactory is implement as expected when set the connectTimeout for RequestConfig at here, at this issue.

But on the version v4.0.5, and at this commit, the function setConnectTimeout is replaced by setConnectionRequestTimeout.
However, the 2 function are not the same:

  • setConnectionRequestTimeout: the connection lease request timeout used when requesting a connection from the connection manager.
  • setConnectTimeout: Determines the timeout until a new connection is fully established. This may also include transport security negotiation exchanges such as SSL or TLS protocol negotiation).

The result is the connect timeout is not working as expected when migrating from HttpComponentsMessageSender to HttpComponents5MessageSender and keeping both functions setConnectionTimeout, setReadTimeout. And the connect timeout will default to 2 minutes despite a specific configuration for HttpComponents5MessageSender.setConnectionTimeout

@phuc98ute phuc98ute changed the title Establish connect timeout to remote server is not work with HttpComponents5ClientFactory Establish connect timeout to remote server is not work with HttpComponents5MessageSender Oct 16, 2024
corneil pushed a commit to corneil/spring-ws that referenced this issue Nov 4, 2024
…ad setConnectionRequestTimeout to restore the behaviour as before.

Fixes spring-projects#1436
@corneil corneil self-assigned this Nov 4, 2024
@corneil corneil added type: regression A regression from a previous release in: core labels Nov 4, 2024
@corneil corneil closed this as completed in b45071b Nov 5, 2024
@snicoll snicoll added this to the 4.0.12 milestone Mar 11, 2025
@snicoll snicoll self-assigned this Mar 11, 2025
@snicoll
Copy link
Member

snicoll commented Mar 11, 2025

This was changed by accident in 4c5bd74. However, this isn't a regression as it's an new class that was shipped in 4.0.5 and was this way from the get-go.

@snicoll snicoll reopened this Mar 11, 2025
@snicoll snicoll added type: bug A general bug and removed type: regression A regression from a previous release labels Mar 11, 2025
@snicoll snicoll changed the title Establish connect timeout to remote server is not work with HttpComponents5MessageSender Connection timeout in HttpComponents5MessageSender is not respected Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants