Integrated: 8362282: runtime/logging/StressAsyncUL.java failed with exitValue = 134

Casper Norrbin cnorrbin at openjdk.org
Wed Sep 10 13:49:37 UTC 2025


On Tue, 9 Sep 2025 11:28:41 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

This pull request has now been integrated.

Changeset: c968a672
Author:    Casper Norrbin <cnorrbin at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/c968a672c034fe533ea5f4ac5efe37ffb76c93e2
Stats:     5 lines in 1 file changed: 2 ins; 2 del; 1 mod

8362282: runtime/logging/StressAsyncUL.java failed with exitValue = 134

Reviewed-by: jsjolen, dholmes

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

PR: https://git.openjdk.org/jdk/pull/27169


More information about the hotspot-runtime-dev mailing list