Virtual threads created more platform threads

Jianbin Chen jianbin at apache.org
Thu Jul 3 06:55:50 UTC 2025


OK I understand now, thank you again for your help.

Best Regards.
Jianbin Chen, github-id: funky-eyes

Alan Bateman <alan.bateman at oracle.com> 于 2025年7月3日周四 14:52写道:

>
> On 03/07/2025 02:14, Jianbin Chen wrote:
> > Sorry to bother you all again. When using virtual threads on JDK 21,
> > I've always been concerned about potential pinning situations, so
> > during testing in our offline environment, we always add the
> > -Djdk.tracePinnedThreads=full parameter. However, we have never seen
> > any pinned-related information output. Yesterday I conducted a test
> > and found that when using synchronized + object.wait(), even though
> > the maximum number of platform threads used by virtual threads has
> > already reached the limit, it still cannot output pinned-related logs.
> > But if I switch to synchronized + Thread.sleep(), it can output the
> > logs. I'm providing my example and JVM parameters below, hoping
> > someone can help explain this issue. Thank you very much.
>
> That rudimentary tracing/debug option printed a stack trace when a
> virtual thread parked inside a synchronized method. It didn't help with
> Object.wait or other cases.
>
> Once you get to JDK 24+ you can drop -Djdk.tracePinnedThreads=full as
> this system property has no effect. The changes to object monitors in
> JDK 24, and the improvements to JFR events for pinning in the same
> release, means the tracing option isn't needed.
>
> -Alan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250703/e4fd2f36/attachment.htm>


More information about the loom-dev mailing list