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

Jaikiran Pai jpai at openjdk.org
Mon Nov 17 12:06:41 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 12 additional commits since the last revision:

 - rename isErroneousClose() to isAbnormalClose()
 - stackless instance for idle timed out NoError
 - Volkan's suggestion - log message improvement
 - merge latest from master branch
 - mark jdk.internal.net.http.Http2Connection as Closable
 - reduce number of concurrent requests
 - cleanup
 - update test
 - Return false from isOpen() if underlying channel is not open
 - Daniel's review suggestion - stop the scheduler when TubeSubscriber errored or completed
 - ... and 2 more: https://git.openjdk.org/jdk/compare/3b9f58c2...1c3f73ba

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28233/files
  - new: https://git.openjdk.org/jdk/pull/28233/files/3e4574b4..1c3f73ba

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

  Stats: 14028 lines in 236 files changed: 7709 ins; 4841 del; 1478 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