RFR: 8326498: java.net.http.HttpClient connection leak using http/2
Jaikiran Pai
jpai at openjdk.org
Tue Nov 11 13:05:09 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.
-------------
Commit messages:
- 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
- introduce a test to reproduce the leak and verify the fix
- 8326498: java.net.http.HttpClient connection leak using http/2
Changes: https://git.openjdk.org/jdk/pull/28233/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28233&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8326498
Stats: 960 lines in 9 files changed: 695 ins; 118 del; 147 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