JDK-8345294 : test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java timeout with JTREG_TEST_THREAD_FACTORY=Virtual
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 24
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: aarch64
  • Submitted: 2024-12-02
  • Updated: 2025-03-18
  • Resolved: 2024-12-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b27Fixed
Related Reports
Relates :  
Relates :  
Description
The newly added test java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java intermittent timed out 480000ms with TEST_THREAD_FACTORY=Virtual, failure probability about 1455/20k, the test log snippet:

"ForkJoinPool-1-worker-1" #38 [182612] daemon prio=5 os_prio=0 cpu=176.18ms elapsed=480.09s tid=0x0000ffff78223da0  [0x0000ffff02acd000]
   Carrying virtual thread #1305
	at jdk.internal.vm.Continuation.run(java.base@24-internal/Continuation.java:252)
	at java.lang.VirtualThread.runContinuation(java.base@24-internal/VirtualThread.java:295)
	at java.lang.VirtualThread$$Lambda/0x000003c00104aef8.run(java.base@24-internal/Unknown Source)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(java.base@24-internal/ForkJoinTask.java:1586)
	at java.util.concurrent.ForkJoinTask.doExec(java.base@24-internal/ForkJoinTask.java:507)
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base@24-internal/ForkJoinPool.java:1395)
	at java.util.concurrent.ForkJoinPool.runWorker(java.base@24-internal/ForkJoinPool.java:1971)
	at java.util.concurrent.ForkJoinWorkerThread.run(java.base@24-internal/ForkJoinWorkerThread.java:187)
   Mounted virtual thread #1305
	at RetryMonitorEnterWhenPinned.lambda$run$2(RetryMonitorEnterWhenPinned.java:85)
	- waiting to lock <0x000000011f4f3db8> (a java.lang.Object)
	at RetryMonitorEnterWhenPinned$$Lambda/0x000003c001001ac0.run(Unknown Source)
	at jdk.test.lib.thread.VThreadPinner$TaskRunner.run(VThreadPinner.java:74)
	at jdk.test.lib.thread.VThreadPinner.callback(VThreadPinner.java:90)
Comments
Changeset: 92e9ac6d Branch: master Author: Doug Lea <dl@openjdk.org> Date: 2024-12-05 12:15:58 +0000 URL: https://git.openjdk.org/jdk/commit/92e9ac6dc7302a140772443f95cc11deb8e3ddcb
05-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22543 Date: 2024-12-04 14:03:58 +0000
04-12-2024

I think this may be related to the FJP update in JDK 24 (JDK-8336707). So far I've only been able to duplicate it on macos-aarch64 debug builds, and only with +SafepointALot. On the 8-core M1s we sometimes end up with 7 active tasks (7 mounted threads that are pinned and blocked in monitor enter) and a queued task for the main thread. The main thread (a virtual thread) has unmounted at CountDownLatch::await, it has been unparked and its task is in the task queue of the carrier for the virtual thread that unparked it, #1341 in this example: ``` 2024-12-03T12:09:24.126342Z -- iteration 7 -- 2024-12-03T12:09:24.129675Z waiting for thread #1335 to block 2024-12-03T12:09:24.129792Z waiting for thread #1336 to block 2024-12-03T12:09:24.129873Z waiting for thread #1337 to block 2024-12-03T12:09:24.129966Z waiting for thread #1338 to block 2024-12-03T12:09:24.130048Z waiting for thread #1339 to block 2024-12-03T12:09:24.130118Z waiting for thread #1340 to block 2024-12-03T12:09:24.130182Z waiting for thread #1341 to block 2024-12-03T12:09:24.369578Z java.util.concurrent.ForkJoinPool@6eb68fef[Running, parallelism = 8, size = 8, active = 7, running = 0, steals = 2301, tasks = 1, submissions = 0] 2024-12-03T12:09:25.518900Z java.util.concurrent.ForkJoinPool@6eb68fef[Running, parallelism = 8, size = 8, active = 7, running = 0, steals = 2301, tasks = 1, submissions = 0] : 2024-12-03T12:16:58.434964Z java.util.concurrent.ForkJoinPool@6eb68fef[Running, parallelism = 8, size = 8, active = 7, running = 0, steals = 2301, tasks = 1, submissions = 0] Timeout signalled after 480 seconds ```
03-12-2024

I've seen a few sightings too but a different failure mode and only with debug builds and -XX:+SafepointALot.
02-12-2024