> 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.
Daniel Fuchs 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 two additional commits since the last revision: - Merge branch 'master' into HttpGetWithCancelledStructuredScope-8316580 - 8316580 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15883/files - new: https://git.openjdk.org/jdk/pull/15883/files/49644147..7e4b6a9e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15883&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15883&range=00-01 Stats: 25605 lines in 503 files changed: 12952 ins; 10249 del; 2404 mod Patch: https://git.openjdk.org/jdk/pull/15883.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15883/head:pull/15883 PR: https://git.openjdk.org/jdk/pull/15883
