Skip to content

Bug fix: Use 1 second timeout when closing out connections inside a connection pool lock#725

Merged
ok2c merged 1 commit into
apache:5.5.xfrom
ok2c:fix_use_1_sec_timeout_when_closing_pooled_connections
Sep 16, 2025
Merged

Bug fix: Use 1 second timeout when closing out connections inside a connection pool lock#725
ok2c merged 1 commit into
apache:5.5.xfrom
ok2c:fix_use_1_sec_timeout_when_closing_pooled_connections

Conversation

@ok2c

@ok2c ok2c commented Sep 15, 2025

Copy link
Copy Markdown
Member

There was a report on the dev list recently about clients getting stuck trying to close out a TLS connection while holding a lock on the connection pool, effectively rendering those clients completely disabled. I thought it should not never happen and it turned out I was wrong. The issue was known and got fixed in core but the fix never got applied to client.

Basically this change-set makes sure the socket timeout is set to 1 second before connections get closed out inside the pool lock.

@arturobernalg Please double-check.

@ok2c ok2c requested a review from arturobernalg September 15, 2025 17:52

@arturobernalg arturobernalg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ok2c ok2c merged commit 038b74f into apache:5.5.x Sep 16, 2025
14 of 15 checks passed
@ok2c ok2c deleted the fix_use_1_sec_timeout_when_closing_pooled_connections branch September 16, 2025 07:32
@ok2c

ok2c commented Sep 16, 2025

Copy link
Copy Markdown
Member Author

@arturobernalg By the way, if you have spare bandwidth and inclination, there is one potential improvement idea one could experiment with. Presently PoolingHttpClientConnectionManager always closes out connections while holding the global pool lock. Even with a timeout of 1 second that can essentially freeze the clients blocked waiting for a connection lease for over one second, which can be a lot for many applications. What one could do is to queue up connections to be closed with a custom DisposalCallback and then close the queued connections out outside of the pool lock. This approach has its risks but it would be a substantial improvement if it can be made to work properly.

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