On Wed, 29 Apr 2026 08:04:23 GMT, SendaoYan <[email protected]> wrote:

> Hi all,
> 
> Test 
> test/jdk/java/lang/management/MemoryMXBean/StressGetTotalGcCpuTimeDuringShutdown.java
>  observed intermittently timed out, both with ZGC and Shenandoah GC. This 
> test create number of $(nproc)*8 daemon theads, and all these threads invoke 
> ManagementFactory.getMemoryMXBean()getTotalGcCpuTime() in the while(true) 
> loop. If the tested machine has many cpu cores, this test will create too 
> many threads and cause too huge stress, thus test intermittently timed out.
> 
> This PR limited the max thread number to 128, this will reduce the thread 
> number pressure. And add `Thread.onSpinWait()` in the while(true) loop will 
> make loop less busy, this change do not change the original test intention.
> 
> Before this change, test failure probability about 5/1000. After this change 
> test run 1000 times and all passed on linux-x64/linux-aarch64.
> 
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Marked as reviewed by kevinw (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/30983#pullrequestreview-4203474611

Reply via email to