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

Alan Bateman alan.bateman at oracle.com
Sat Nov 22 08:42:37 UTC 2025


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/20251122/b8d5b686/attachment-0001.htm>


More information about the loom-dev mailing list