RFR: 8297424: java/net/httpclient/AsyncExecutorShutdown.java fails in AssertionError due to misplaced assert [v3]
Daniel Fuchs
dfuchs at openjdk.org
Mon Nov 28 14:09:59 UTC 2022
> The `ResponseSubscribers.HttpResponseInputStream` class has an assert that has been observed firing (rarely) when running the `java/net/httpclient/AsyncExecutorShutdown.java` test.
>
> After a thorough analysis of the code and the log failure I am convinced that the issue is due to a misplaced assert.
> If cancellation happens asynchronously while the subscriber is being subscribed with the lower layers of the stack, the `HttpResponseInputStream` might get closed and the `LAST_LIST` buffer might be offered after `closed == false` has been observed by the `onSubscribed` method, but before the assertion has been checked. The assertion assumes that the queue must be empty, but it might not if `close` has been called and the `LAST_LIST` buffer has been offered.
>
> Moving the assert from within the synchronized block, to ensure that the observed value of `closed` is consistent with the state of the queue, should fix it. I have tagged the bug as `noreg-hard`, I'm not sure it would be fair to say that `AsyncExecutorShutdown.java` can be used to verify the fix.
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 four additional commits since the last revision:
- Merge branch 'master' into AsyncExecutorShutdown-8297424
- Merge branch 'master' into AsyncExecutorShutdown-8297424
- Revert assignement of pendingResponseSubscriber to null to avoid race conditions with ternary operators
- 8297424
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11332/files
- new: https://git.openjdk.org/jdk/pull/11332/files/71b59be3..33972211
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11332&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11332&range=01-02
Stats: 4499 lines in 106 files changed: 3466 ins; 609 del; 424 mod
Patch: https://git.openjdk.org/jdk/pull/11332.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11332/head:pull/11332
PR: https://git.openjdk.org/jdk/pull/11332
More information about the net-dev
mailing list