RFR: 8372159: HttpClient SelectorManager thread could be a VirtualThread [v2]
Daniel Fuchs
dfuchs at openjdk.org
Thu Nov 20 09:56:34 UTC 2025
On Thu, 20 Nov 2025 09:37:31 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Revert changes to SelectorManager::shutdown
>
> test/jdk/java/net/httpclient/http2/H2SelectorVTTest.java line 175:
>
>> 173: final HttpRequest req1 = reqBuilder.copy().GET().build();
>> 174: System.out.println("\nIssuing request: " + req1);
>> 175: final HttpResponse<?> resp1 = client.send(req1, BodyHandlers.ofString());
>
> Nit - this line and the other 3 send() lines could perhaps use `BodyHandlers.discarding()`? If you prefer to use `ofString()`, that's fine too - it wasn't clear to me if this was an oversight.
If you look at the log you will see that there is an exception being logged by Log "errors" at the end of each method. The exception is "selector manager closed". At first I thought it was caused by using `BodyHandlers.discarding()` - which I suspected might return a result early and discard data in the background.
This is why I changed all to ofString(). But the exception is still there.
The exception is logged because the selector is closed before all connections have been closed.
Trying to fix that I stumbled on an another issue - [JDK-8372198](https://bugs.openjdk.org/browse/JDK-8372198) - so I decided to revert my attempted fix https://github.com/openjdk/jdk/pull/28395/commits/dd4acad7528f1c401cb7cd5f15a4074c1be53be1 and fix that later in a follow up. But I kept `ofString`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28395#discussion_r2545188393
More information about the net-dev
mailing list