<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi George,<br>
<br>
I just noticed that my reply never made it to the list.<br>
<br>
Thanks for raising awareness of this issue!</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature" class="elementToProof" style="color: inherit;">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,<br>
–</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b><br>
</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Viktor Klang</b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> concurrency-discuss <concurrency-discuss-retn@openjdk.org> on behalf of George Lu <george.lu@broadcom.com><br>
<b>Sent:</b> Friday, 28 February 2025 21:51<br>
<b>To:</b> concurrency-discuss@openjdk.org <concurrency-discuss@openjdk.org><br>
<b>Subject:</b> ForkJoinPool TC underflow issue in JDK 11 and 17 (JDK-8330017)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi all,<br>
<br>
There is a known issue (JDK-8330017) in JDK 11 and 17 where the<br>
ForkJoinPool can hang when the Release Count (RC) reaches<br>
ForkJoinPool.MAX_CAP.<br>
<br>
This occurs due to an underflow in Total Count (TC) when attempting to<br>
signal for deregisterWorker. Specifically, in JDK 17, the following<br>
line:<br>
<br>
    compareAndSetCtl(c, ((UC_MASK & (c - TC_UNIT)) | (prevCtl & SP_MASK))))<br>
<br>
When TC == 0, (c - TC_UNIT) underflows, unintentionally decrementing<br>
RC by 1. Notably, TC == 0 is not a rare edge case (since total workers<br>
== parallelism is common), meaning this accidental underflow can occur<br>
frequently. We have encountered this issue in two of our long-running<br>
JVMs. A possible fix is to properly mask TC and RC as follows:<br>
<br>
    compareAndSetCtl(c, ((RC_MASK & c) | (TC_MASK & (c - TC_UNIT)) |<br>
(prevCtl & SP_MASK))))<br>
<br>
Regards,<br>
George<br>
<br>
-- <br>
This electronic communication and the information and any files transmitted <br>
with it, or attached to it, are confidential and are intended solely for <br>
the use of the individual or entity to whom it is addressed and may contain <br>
information that is confidential, legally privileged, protected by privacy <br>
laws, or otherwise restricted from disclosure to anyone else. If you are <br>
not the intended recipient or the person responsible for delivering the <br>
e-mail to the intended recipient, you are hereby notified that any use, <br>
copying, distributing, dissemination, forwarding, printing, or copying of <br>
this e-mail is strictly prohibited. If you received this e-mail in error, <br>
please return the e-mail to the sender, delete it from your computer, and <br>
destroy any printed copy of it.<br>
</div>
</span></font></div>
</body>
</html>