<div dir="ltr">Hi Alan,<br><br>Thanks for the clarifications!<br>OK regarding the pooling of the VT, now I understand what robert meant about the partial code example.<br><br>The scheduler is created in this way:<br><span style="padding:0px 2px"><span style="padding:0px 2px"><span style="color:rgb(0,0,0);font-family:Consolas;font-size:10pt;white-space:pre">ScheduledExecutorService <span style="color:rgb(106,62,62)">scheduler = </span></span></span><span style="color:rgb(0,0,0);font-family:Consolas;font-size:10pt;white-space:pre">Executors.<span style="font-style:italic">newScheduledThreadPool</span>(1)
</span></span><br><div>then as the code example shows after it is granted with a permit to execute a task, it delegates it to the VT by starting it this way:<br><span style="padding:0px 2px"><span style="color:rgb(0,0,0);font-family:Consolas;font-size:10pt;white-space:pre">Thread.<span style="font-style:italic">ofVirtual</span>().start(() -> { ... }</span></span><br></div><div><span style="padding:0px 2px"><span style="color:rgb(0,0,0);font-family:Consolas;font-size:10pt;white-space:pre"><br></span></span></div><div>I upgrade the jdk to the latest EA and test it again, and get back to you in any case with the relevant thread dumps.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 21 Jul 2024 at 22:56, Alan Bateman <<a href="mailto:Alan.Bateman@oracle.com">Alan.Bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 21/07/2024 19:14, Yuval Lombard wrote:<br>
> Hi Alan,<br>
><br>
> By "So I<br>
> think you are running into a bug.." do you mean on my end? (Hope you <br>
> do 😅)<br>
<br>
I should have been clearer, I meant this is likely a JDK bug in the EA <br>
build. From the thread I'm 80% certain it's related preemption when <br>
cancelling the timer after Object.wait(millis).<br>
<br>
The only thing that you might want to check is whether something is <br>
accidentally pooling virtual threads to execute periodic tasks, meaning <br>
something is calling Executors.newScheduleThreadPool with a thread <br>
factory that creates virtual threads. It's not the cause of this hang, <br>
just something that I see in the thread dump.<br>
<br>
><br>
> When scheduling my tasks with platform threads I dont see it is being <br>
> reproduced, although I must say my current platform threads scheduler <br>
> is different (quartz scheduler) and does not make use of semaphores <br>
> (but instead it pools its workers) that is why I suspect my usage of <br>
> semaphores with VT.<br>
><br>
> Also when I try to execute the vthread_summary command you suggested I <br>
> get this error:<br>
> java.lang.IllegalArgumentException: Unknown diagnostic command<br>
Ah right, this jcmd is not in the older EA build so it can't be used <br>
until you pick up a more recent EA build.<br>
<br>
-Alan<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><p class="MsoNormal" style="color:rgb(34,34,34);font-size:small;background-image:initial;background-position:initial;background-repeat:initial">Kind regards,<b style="font-size:13.3333px;color:rgb(0,176,240);font-family:Ebrima"><br><br>Yuval Lombard</b><br></p><p class="MsoNormal" style="color:rgb(34,34,34);font-size:small;background-image:initial;background-position:initial;background-repeat:initial"><font color="#3b3838" face="Ebrima"><span style="font-size:12px"><b>Lead Software Engineer</b></span></font></p><p class="MsoNormal" style="color:rgb(34,34,34);font-size:small;background-image:initial;background-position:initial;background-repeat:initial"><span style="font-size:9pt;font-family:Ebrima;color:rgb(59,56,56)">+972.50.548.0111</span><span style="font-size:9pt;font-family:Ebrima;color:rgb(64,64,64)"><u></u><u></u></span></p><p class="MsoNormal" style="color:rgb(34,34,34);font-size:small;background-image:initial;background-position:initial;background-repeat:initial"><font color="#0000ff" face="Ebrima"><span style="font-size:12px"><a href="mailto:yuval.l@securithings.com" style="color:rgb(17,85,204)" target="_blank">yuval.l@securithings.com</a></span></font></p><p class="MsoNormal" style="color:rgb(34,34,34);font-size:small;background-image:initial;background-position:initial;background-repeat:initial"><img src="cid:ii_l13cyhga0" alt="logo_black.png" width="200" height="47"></p></div></div></div></div>