On Fri, 14 Aug 2026 01:06:42 GMT, Leonid Mesnik <[email protected]> wrote:
> The jcmd might crash while calling ThreadSnapshot.of() for thread that have
> monitors.
>
> Originally, the jcmd crashed while calling by jtreg timeout failure handler
> for test `compiler/c2/Test6603011.java` while it was executed with
> `-XX:+StressBailout`. The `-XX:+StressBailout` is not related to crash, just
> cause test timeout.
>
> The main cause of crash is that test was executed with `-Xcomp -XX:-Inline`.
> See:
> * @run main/othervm/timeout=480 -Xcomp -Xbatch -XX:-Inline
> compiler.c2.Test6603011
>
> That provokes the access to uninitialized ThreadSnapshot$ThreadLock class.
>
> The ThreadSnapshot has a field
> `private ThreadLock[] locks;`
> that is initialized by VM native code.
>
> The corresponding class is not initialized during this creation.
>
> The `-XX:CompileCommand=compileonly,*ThreadSnapshot*::*` in test is required
> only to optimize execution. It fails without it as well.
>
> The ThreadSnapshot is initialized:
> `
> Klass* snapshot_klass =
> SystemDictionary::resolve_or_fail(snapshot_klass_name, true, CHECK_NULL);
> if (snapshot_klass->should_be_initialized()) {
> snapshot_klass->initialize(CHECK_NULL);
> }
>
> `
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/jdk/pull/32362