RFR: 8365893: test/jdk/java/lang/Thread/virtual/JfrEvents.java failing intermittently

Jaikiran Pai jpai at openjdk.org
Sun Aug 24 08:56:53 UTC 2025


On Sun, 24 Aug 2025 07:59:05 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Under load conditions, testVirtualThreadStartAndEnd can fail because the JFR recording doesn't have a VirtualThreadEndEvent recorded for all virtual threads. This is a test issue. ExecutorService::close waits for all tasks (not threads) to finish. For ThreadPerTaskExecutor the thread terminates after executing the task but there is still a small window between task completion and thread termination.  The test is changed to use Thread::join so it waits for the 100 threads to terminate, avoid the fragile sleep that we had in the original test.

This looks good to me.

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

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26916#pullrequestreview-3149246326


More information about the core-libs-dev mailing list