RFR: 8326498: java.net.http.HttpClient connection leak using http/2 [v12]

Jaikiran Pai jpai at openjdk.org
Mon Nov 24 10:25:14 UTC 2025


> Can I please get a review for this fix which addresses a connection leak in HttpClient when dealing with HTTP/2 requests?
> 
> I have added a comment in https://bugs.openjdk.org/browse/JDK-8326498 which explains what the issue is. The fix here addresses the issue by cleaning up the `Http2Connection` closing logic and centralizing it to a connection terminator. The terminator then ensures that the right resources are closed (including the underlying SocketChannel) when the termination happens.
> 
> A new jtreg test has been introduced which reproduces the issue and verifies the fix.

Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 26 additional commits since the last revision:

 - merge latest from master branch
 - Daniel's review - remove unnecessary wrapping of exception
 - use ClosedChannelException instead of IOException
 - introduce HttpClientImplAccess instead of using Http3ConnectionAccess
 - use H3ConnectionAccess in test and remove the @modules usage
 - Remove import
 - use Utils.toIOException()
 - rename method
 - remove unneeded method
 - logging and javadoc comment fixes
 - ... and 16 more: https://git.openjdk.org/jdk/compare/48d16249...b7389dde

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/28233/files
  - new: https://git.openjdk.org/jdk/pull/28233/files/79ff938b..b7389dde

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28233&range=11
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28233&range=10-11

  Stats: 38731 lines in 529 files changed: 28109 ins; 7580 del; 3042 mod
  Patch: https://git.openjdk.org/jdk/pull/28233.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28233/head:pull/28233

PR: https://git.openjdk.org/jdk/pull/28233


More information about the net-dev mailing list