RFR: 8362282: runtime/logging/StressAsyncUL.java failed with exitValue = 134 [v2]

Johan Sjölen jsjolen at openjdk.org
Wed Sep 10 08:13:05 UTC 2025


On Wed, 10 Sep 2025 08:03:17 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

>> 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

Marked as reviewed by jsjolen (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/27169#pullrequestreview-3204980196


More information about the hotspot-runtime-dev mailing list