<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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);">
Thank you, Marko - it's an excellent catch! Indeed, we have a bug in a code that updates the left timeout. And yes, we should use nanoTime for measuring elapsed time. I will work on a fix for both issues and will try to create a test for the left timeout update
 scenario.</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 class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
- Aleksei</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> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Daniel Fuchs <daniel.fuchs@oracle.com><br>
<b>Sent:</b> 04 September 2024 3:59 PM<br>
<b>To:</b> Marko Bakšić <Marko.Baksic@infobip.com>; core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject:</b> Re: Possible bug in jdk.naming.dns. I need guidance on how get someone smarter to look at it.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 04/09/2024 15:02, Marko Bakšić wrote:<br>
> Thank you Daniel.<br>
> <br>
> The part that was suspicious to me is<br>
> <br>
> ```<br>
> int timeoutLeft = pktTimeout;<br>
> do {<br>
>       ...<br>
>       timeoutLeft = pktTimeout - ((int) (end - start));<br>
> } while (timeoutLeft > MIN_TIMEOUT);<br>
> ```<br>
> <br>
> Here, timeoutLeft is not iteratively decreased, but is always derived <br>
> from `pktTimeout`.<br>
> I can see a case where `timeoutLeft` never drops below `MIN_TIMEOUT` <br>
> (this is the part where I'm not sure if I'm missing some deeper knowledge).<br>
<br>
Indeed - good observation!<br>
<br>
-- daniel<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>