Significant degradation of Thread.sleep with virtual threads in JDK 25 vs JDK 21

Fredriksson, Christian christian.fredriksson.2 at volvocars.com
Tue Nov 25 16:04:58 UTC 2025


I have tested with latest JDK 24 and do *not* see the issue there, only on JDK 25.

I have attached the output of running that jcmd every 15 seconds when the issue happened on JDK 25.

The jcmd output log covers 15:38:00 to 15:48:00. I saw the problems in my application between 15:40:00 and 15:45:45.

Christian Fredriksson
T +46 734 63 71 06
christian.fredriksson.2 at volvocars.com<mailto:christian.fredriksson.2 at volvocars.com>

VOLVO CAR CORPORATION


From: Alan Bateman <alan.bateman at oracle.com>
Sent: Saturday, 22 November 2025 09:43
To: Fredriksson, Christian <christian.fredriksson.2 at volvocars.com>; loom-dev at openjdk.org
Subject: Re: Significant degradation of Thread.sleep with virtual threads in JDK 25 vs JDK 21

You don't often get email from alan.bateman at oracle.com<mailto:alan.bateman at oracle.com>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
On 21/11/2025 18:25, Fredriksson, Christian wrote:
Thank you.
Unfortunately I've been unable to reproduce it locally outside of our runtime environment, but I do have a reliable reproducer there.

Would it help if I test this also with JDK 24/23/22?

Otherwise I can wait until JDK-8370887 is fixed (next release of JDK 25?) and test again then.


If you can see if it reproduces with JDK 24 then it would narrow this down. It would also be useful to capture the output from running `jcmd <pid> Thread.vthread_scheduler` a few times while it executes as this includes info on delayed tasks.

It's possible it is related to JDK-8370887 but if all the sleeps are sleep(1) and there is no interrupt/cancellation then there may not be replacing going on to observe that issue. It may of course be that the picture is more complicated. In any case, expect a JDK 26 EA build soon with a fix to that issue.

You mentioned it reproduces in a single CPU environment. It's possible that is relevant although your message said you also test with jdk.virtualThreadScheduler.parallelism set so that might rule it out.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20251125/0e4aabdd/attachment-0001.htm>
-------------- next part --------------
15:38:12.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 256812, tasks = 0, submissions = 0, delayed = 71]
15:38:27.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 257276, tasks = 0, submissions = 0, delayed = 58]
15:38:42.581: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 1, running = 0, steals = 257889, tasks = 0, submissions = 0, delayed = 36]
15:38:57.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 258992, tasks = 0, submissions = 0, delayed = 27]
15:39:12.583: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 261035, tasks = 0, submissions = 0, delayed = 88]
15:39:27.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 261592, tasks = 0, submissions = 0, delayed = 91]
15:39:42.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 262142, tasks = 0, submissions = 0, delayed = 48]
15:39:57.578: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 262509, tasks = 0, submissions = 0, delayed = 54]
15:40:12.582: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 263099, tasks = 0, submissions = 0, delayed = 46]
15:40:27.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 263716, tasks = 0, submissions = 0, delayed = 43]
15:40:42.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 264256, tasks = 0, submissions = 0, delayed = 33]
15:40:57.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 264813, tasks = 0, submissions = 0, delayed = 22]
15:41:12.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 265485, tasks = 0, submissions = 0, delayed = 20]
15:41:27.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 266107, tasks = 0, submissions = 0, delayed = 19]
15:41:42.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 266725, tasks = 0, submissions = 0, delayed = 18]
15:41:57.581: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 267347, tasks = 0, submissions = 0, delayed = 18]
15:42:12.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 267964, tasks = 0, submissions = 0, delayed = 18]
15:42:27.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 268613, tasks = 0, submissions = 0, delayed = 18]
15:42:42.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 269250, tasks = 0, submissions = 0, delayed = 18]
15:42:57.581: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 269886, tasks = 0, submissions = 0, delayed = 18]
15:43:12.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 270516, tasks = 0, submissions = 0, delayed = 18] 
15:43:27.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 271398, tasks = 0, submissions = 0, delayed = 18]
15:43:42.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 272082, tasks = 0, submissions = 0, delayed = 18]
15:43:57.578: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 272765, tasks = 0, submissions = 0, delayed = 18]
15:44:12.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 273487, tasks = 0, submissions = 0, delayed = 18]
15:44:27.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 274194, tasks = 0, submissions = 0, delayed = 16]
15:44:42.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 274861, tasks = 0, submissions = 0, delayed = 16]
15:44:57.580: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 275516, tasks = 0, submissions = 0, delayed = 16]
15:45:12.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 280385, tasks = 0, submissions = 0, delayed = 5]
15:45:27.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 286022, tasks = 0, submissions = 0, delayed = 5]
15:45:42.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 286745, tasks = 0, submissions = 0, delayed = 5]
15:45:57.577: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 287578, tasks = 0, submissions = 0, delayed = 5]
15:46:12.575: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 288361, tasks = 0, submissions = 0, delayed = 5]
15:46:27.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 289154, tasks = 0, submissions = 0, delayed = 5]
15:46:42.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 289877, tasks = 0, submissions = 0, delayed = 5]
15:46:57.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 290695, tasks = 0, submissions = 0, delayed = 5]
15:47:12.578: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 291372, tasks = 0, submissions = 0, delayed = 5]
15:47:27.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 292222, tasks = 0, submissions = 0, delayed = 5]
15:47:42.576: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 292920, tasks = 0, submissions = 0, delayed = 5]
15:47:57.579: java.util.concurrent.ForkJoinPool at 1f260ab9[Running, parallelism = 8, size = 8, active = 0, running = 0, steals = 293739, tasks = 0, submissions = 0, delayed = 5]


More information about the loom-dev mailing list