RFR: 8362282: runtime/logging/StressAsyncUL.java failed with exitValue = 134 [v2]
Casper Norrbin
cnorrbin at openjdk.org
Wed Sep 10 08:03:17 UTC 2025
> Hi everyone,
>
> During `AsyncLogWriter` initialization we previously published the global `AsyncLogWriter _instance` before waiting for existing synchronous logging activity to finish and before starting the async consumer thread. As soon as `_instance` became visible, `is_enqueue_allowed()` allowed new log calls to switch to the async path. Those calls bumped `LogOutputList`'s counters while `initialize()` was waiting for `wait_until_no_readers()` to observe no active readers. At the same time, because the consumer thread wasn’t yet running, producers could end up waiting for a consumer that didn’t exist. In rare timing, this created a circular wait that manifested as intermittent lock-ups in `StressAsyncUL.java`.
>
> The initialization order is changed so that we do not make the async writer visible until after all pre-existing synchronous logging has completed. Concretely, `initialize()` now:
>
> 1. waits for each `LogTagSet` to report no readers, ensuring synchronous logging is done,
> 2. publishes `_instance` with a release store so readers observe a fully initialized writer, and
> 3. immediately starts the async logging thread.
>
> With this ordering, new async producers cannot keep the counters inflated while initialization is waiting. Any messages produced in the brief window between publishing `_instance` and the thread's first run are safely buffered and then consumed as soon as the thread starts.
>
> Testing:
> - Oracle tiers 1-3
> - Repeated runs of `StressAsyncUL.java` with no observed lock-ups
Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
changed comment wording
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27169/files
- new: https://git.openjdk.org/jdk/pull/27169/files/d8dd6162..8e42198b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27169&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27169&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/27169.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27169/head:pull/27169
PR: https://git.openjdk.org/jdk/pull/27169
More information about the hotspot-runtime-dev
mailing list