Skip to content

chore: Fix unexpected connection-pool shut-down - #1095

Merged
CharlesDuboisSAP merged 26 commits into
mainfrom
fix-connection-pool-shut-down
Aug 5, 2026
Merged

chore: Fix unexpected connection-pool shut-down#1095
CharlesDuboisSAP merged 26 commits into
mainfrom
fix-connection-pool-shut-down

Conversation

@newtork

@newtork newtork commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Context

Related

I was wondering whether the following rule always holds true...?

Tenant+Destination 1 <-> 1 (Cloud SDK) HttpClient 1 <-> 1 Connection Manager 1 <-> 1 Connection Pool

I thought that would be correct, until I realized there's one exception in HttpClientWrapper.
The following method creates a new HttpClient and inherits the connection-pool implicitly:

HttpClientWrapper withDestination( final HttpDestinationProperties destination )
{
// explicitly check the reference equality, since equals doesn't check header providers
// this is a slight improvement, avoiding unnecessary wrapper instantiation
// in cases where destination objects are reused / served from cache
if( !destination.equals(this.destination) ) {
throw new ShouldNotHappenException(
"This method must not be used outside of updating an instance of HttpClientWrapper for http clients served from the HttpClientCache.");
}
if( destination == this.destination ) {
return this;
}
return new HttpClientWrapper(httpClient, destination);
}

I'm able to reproduce the reported bug.
That even can explain the observed behavior from garbage collector.

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Documentation updated
  • Release notes updated

@newtork
newtork marked this pull request as draft February 11, 2026 16:10
@newtork newtork added the bug Something isn't working label Apr 27, 2026
@CharlesDuboisSAP
CharlesDuboisSAP marked this pull request as ready for review August 4, 2026 12:50
@CharlesDuboisSAP CharlesDuboisSAP self-assigned this Aug 4, 2026
@CharlesDuboisSAP CharlesDuboisSAP added please merge Request to merge a pull request please review Request to review a pull request labels Aug 4, 2026
@CharlesDuboisSAP CharlesDuboisSAP changed the title chore: Fix unexpected connection-pool shut-down of HttpClient4 chore: Fix unexpected connection-pool shut-down Aug 4, 2026

@Jonas-Isr Jonas-Isr 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.

Mostly LGTM :)

@CharlesDuboisSAP
CharlesDuboisSAP enabled auto-merge (squash) August 5, 2026 07:20
@Jonas-Isr
Jonas-Isr disabled auto-merge August 5, 2026 09:24
@CharlesDuboisSAP
CharlesDuboisSAP merged commit 9f012fb into main Aug 5, 2026
13 checks passed
@CharlesDuboisSAP
CharlesDuboisSAP deleted the fix-connection-pool-shut-down branch August 5, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working please merge Request to merge a pull request please review Request to review a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants