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

Alan Bateman alanb at openjdk.org
Sun Aug 24 08:25:31 UTC 2025


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.

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

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/26916/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26916&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8365893
  Stats: 8 lines in 1 file changed: 3 ins; 1 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/26916.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26916/head:pull/26916

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


More information about the core-libs-dev mailing list