On Mon, 16 Mar 2026 15:50:42 GMT, Kevin Walls <[email protected]> wrote:

>> Zhengyu Gu has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Fix test
>
> Hi @zhengyu123  here is a simplified version of the test - there were a few 
> things in there which were not needed.
> 
> The test usually crashes very quickly if the problem is present.  Often on 
> the first or second iteration of the main loop.
> If not crashing, with 4 iterations in the main loop, it may run for around 12 
> seconds.
> 
> 
> 
> /*
>  * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
>  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>  *
>  * This code is free software; you can redistribute it and/or modify it
>  * under the terms of the GNU General Public License version 2 only, as
>  * published by the Free Software Foundation.
>  *
>  * This code is distributed in the hope that it will be useful, but WITHOUT
>  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
>  * version 2 for more details (a copy is included in the LICENSE file that
>  * accompanied this code).
>  *
>  * You should have received a copy of the GNU General Public License version
>  * 2 along with this work; if not, write to the Free Software Foundation,
>  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
>  *
>  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
>  * or visit www.oracle.com if you need additional information or have any
>  * questions.
>  */
> 
> import jdk.test.lib.Utils;
> 
> import java.lang.management.ManagementFactory;
> import java.lang.management.ThreadInfo;
> import java.lang.management.ThreadMXBean;
> 
> import java.util.ArrayList;
> import java.util.List;
> import java.util.concurrent.locks.ReentrantLock;
> 
> /*
>  * @test
>  * @bug 8323792
>  * @summary Make sure that jmm_GetThreadInfo() call does not crash JVM
>  * @library /test/lib
>  * @modules java.management
>  * @run main/othervm ThreadInfoTest
>  *
>  * @comment Exercise getThreadInfo(ids, 0).  Depth parameter of zero means
>  * no VM operation, which could crash with Threads starting and ending.
>  */
> 
> public class ThreadInfoTest {
>     private static com.sun.management.ThreadMXBean mbean =
>         (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
> 
>     private static final int NUM_THREADS = 2;
>     static long[] ids = new long[NUM_THREADS];
>     static ThreadInfo[] infos = new ThreadInfo[NUM_THREADS];
>     static volatile int count = 0;
>     static int ITERATIONS = 4;
> 
>     public static void main(String[] argv) throws Exception {
>         boolean replacing = false;
> 
>         startThreads(ids, NUM_THR...

> @kevinjwalls

Yes, the reproducer was very helpful in reproducing the crash. I really 
appreciate you providing it.

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

PR Comment: https://git.openjdk.org/jdk/pull/30105#issuecomment-4070304443

Reply via email to