fix: expose idleTimeout, timeToLive and validateAfterInactivity on HttpClient5 connection pool - #1293
Draft
cassiofariasmachado wants to merge 1 commit into
Draft
cassiofariasmachado wants to merge 1 commit into
cassiofariasmachado wants to merge 1 commit into
Conversation
…tpClient5 connection pool
cassiofariasmachado
force-pushed
the
fix/idle-timeout
branch
from
September 30, 2026 18:42
3bc9982 to
f966adb
Compare
NicoleMGomes
approved these changes
Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
On BTP Cloud Foundry, NAT gateways silently drop idle TCP connections after a hyperscaler-specific timeout (GCP ~600s, Azure ~240s, AWS ~300s). Without connection pool eviction configured, the SDK keeps half-open sockets indefinitely. The next request that reuses one stalls for ~120s waiting for the OS TCP retry budget before the retry strategy reconnects.
This PR exposes three new opt-in configuration methods on
ApacheHttpClient5FactoryBuilderso affected applications can configure connection pool eviction without changing behavior for other consumers:idleTimeout(Duration)— evict connections idle longer than this periodtimeToLive(Duration)— hard cap on total connection lifetime regardless of activityvalidateAfterInactivity(Duration)— probe connections after inactivity before reuseAll three default to
null(no change in existing behavior).DefaultApacheHttpClient5Factoryapplies each only when explicitly set via a newbuildConnectionConfig()helper.Workaround for affected applications (usable today before a release):
Feature scope:
idleTimeout(Duration)added toApacheHttpClient5FactoryBuildertimeToLive(Duration)added toApacheHttpClient5FactoryBuildervalidateAfterInactivity(Duration)added toApacheHttpClient5FactoryBuilderDefaultApacheHttpClient5Factoryapplies each setting only when explicitly providedAbstractHttpClientFactory— follow-up PR (HC4 requires a background evictor thread)Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated