Integrated: 8316580: HttpClient with StructuredTaskScope does not close when a task fails
Daniel Fuchs
dfuchs at openjdk.org
Thu Sep 28 13:35:43 UTC 2023
On Fri, 22 Sep 2023 09:01:28 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Hi,
>
> Please find below a fix for 8316580: HttpClient with StructuredTaskScope does not close when a task fails.
>
> The problem here is a subtle reference release issue: Interrupting the VirtualThread means that the CompletableFuture returned by sendAsync is eligible for GC after having been cancelled, which in turn means that some of the intermediate operations that would have been completed before that CF was completed get eligible for being GC’ed too. One of these intermediate operations is the action that decrements the ref counting. Since the refcount isn’t decremented properly, the client won’t exit.
>
> Holding onto the CompletableFuture returned to the caller by HttpClient::sendAsync until that CompletableFuture gets completed from upstream fixes the issue.
This pull request has now been integrated.
Changeset: fc989986
Author: Daniel Fuchs <dfuchs at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/fc98998627443d6e73ac70661f47f48b30525712
Stats: 463 lines in 4 files changed: 436 ins; 10 del; 17 mod
8316580: HttpClient with StructuredTaskScope does not close when a task fails
Reviewed-by: djelinski
-------------
PR: https://git.openjdk.org/jdk/pull/15883
More information about the net-dev
mailing list