<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 Daniel.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The part that was suspicious to me is</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
```</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
int timeoutLeft = pktTimeout;<br>
do {<br>
      ...</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
      timeoutLeft = pktTimeout - ((int) (end - start));</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
} while (timeoutLeft > MIN_TIMEOUT);</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
```</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Here, timeoutLeft is not iteratively decreased, but is always derived from `pktTimeout`.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I can see a case where `timeoutLeft` never drops below `MIN_TIMEOUT` (this is the part where I'm not sure if I'm missing some deeper knowledge).</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kind regards,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
-- Marko</div>
<div id="appendonsend"></div>

<P style="FONT-SIZE: 10pt; FONT-FAMILY: ARIAL; COLOR: #373a3b"> </P>
<P 
style="FONT-SIZE: 10pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: ARIAL; COLOR: #373a3b; MARGIN-LEFT: 10px">
<TABLE style="WIDTH: 865px; COLOR: #373a3b" cellSpacing=0 cellPadding=0 
border=0>
  <TBODY style="COLOR: #373a3b">
  <TR style="COLOR: #373a3b">
    <TD 
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; WIDTH: 65px; COLOR: #373a3b; PADDING-LEFT: 0px; PADDING-RIGHT: 20px" 
    vAlign=bottom><IMG style="HEIGHT: 60px; WIDTH: 65px" border=0 
      src="cid:Infobip_logo_vertical_signature_e28e13d2-255b-4571-a70c-8292f2d75c0b.png" width=65 
      height=60></TD>
    <TD 
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; WIDTH: 800px; COLOR: #373a3b" 
    vAlign=bottom>
      <TABLE style="COLOR: #373a3b" cellSpacing=0 cellPadding=0 border=0>
        <TBODY style="COLOR: #373a3b">
        <TR style="COLOR: #373a3b">
          <TD 
          style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; COLOR: #373a3b; PADDING-LEFT: 11px; PADDING-RIGHT: 19px" 
          vAlign=bottom align=left>
            <P 
            style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; COLOR: #373a3b; MARGIN: 0px 0px 2px"><STRONG 
            style="COLOR: #373a3b">Marko Bak&#x161;i&#x107;</STRONG><BR></P>
            <P 
            style="FONT-SIZE: 10pt; MARGIN-BOTTOM: 2px; FONT-FAMILY: Arial; MARGIN-TOP: 0px"><SPAN 
            style="FONT-SIZE: 8.4pt">Software Engineer</SPAN></P></TD>
          <TD 
          style="FONT-SIZE: 8.4pt; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; COLOR: #373a3b; PADDING-LEFT: 20px; BORDER-LEFT: black 1px solid; PADDING-RIGHT: 20px" 
          vAlign=bottom>
            <P 
            style="FONT-SIZE: 8.4pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial; MARGIN-TOP: 0px"><STRONG 
            style="COLOR: #373a3b">E </STRONG><SPAN 
            style="FONT-SIZE: 8.4pt">Marko.Baksic@infobip.com</SPAN><BR></P>
            <P 
            style="FONT-SIZE: 8.4pt; MARGIN-BOTTOM: 2px; FONT-FAMILY: Arial; MARGIN-TOP: 0px"><STRONG 
            style="COLOR: #373a3b">M</STRONG> <SPAN 
            style="FONT-SIZE: 8.4pt"></SPAN></P></TD>
          <TD 
          style="FONT-SIZE: 8.4pt; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; COLOR: #373a3b; PADDING-LEFT: 20px; BORDER-LEFT: black 1px solid; PADDING-RIGHT: 20px" 
          vAlign=bottom>
            <P 
            style="FONT-SIZE: 8.4pt; MARGIN-BOTTOM: 5px; FONT-FAMILY: Arial; MARGIN-TOP: 0px"><STRONG 
            style="COLOR: #373a3b">A </STRONG><SPAN 
            style="FONT-SIZE: 8.4pt">Utinjska 29A, 10000 
            Zagreb, Croatia<BR></SPAN></P>
            <P 
            style="FONT-SIZE: 8.4pt; MARGIN-BOTTOM: 2px; FONT-FAMILY: Arial; MARGIN-TOP: 0px"><A 
            style="TEXT-DECORATION: none; COLOR: #373a3b" 
            href="http://www.infobip.com">www.infobip.com<SPAN 
            style="FONT-SIZE: 9pt"></SPAN></A></P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></P>
<P 
style="FONT-SIZE: 10pt; MARGIN-BOTTOM: 5pt; FONT-FAMILY: Arial; MARGIN-TOP: 0px; COLOR: #373a3b"> </P>
<P 
style="FONT-SIZE: 10pt; MARGIN-BOTTOM: 5pt; FONT-FAMILY: Arial; MARGIN-TOP: 0px; COLOR: #373a3b"> </P><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> Daniel Fuchs <daniel.fuchs@oracle.com><br>
<b>Sent:</b> Wednesday, September 4, 2024 15:27<br>
<b>To:</b> Marko Bakšić <Marko.Baksic@infobip.com><br>
<b>Subject:</b> [EXTERNAL] 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">Hi Marko,<br>
<br>
This is not the proper list for this kind of question:<br>
I'm moving the discussion to core-libs-dev at openjdk.org.<br>
<br>
There's definitely a bug here: that code should use<br>
System.nanoTime() and not System.currentTimeMillis()<br>
since the latter is not guaranteed to be monotonic.<br>
<br>
It may not explain the issue you are observing, but<br>
again, it may cause the timeout to punctually increase.<br>
<br>
I have logged<br>
<a href="https://bugs.openjdk.org/browse/JDK-8339538">https://bugs.openjdk.org/browse/JDK-8339538</a><br>
<br>
I wonder if that has an impact on what you are observing.<br>
<br>
best regards,<br>
<br>
-- daniel<br>
<br>
On 04/09/2024 13:50, Marko Bakšić wrote:<br>
> Hey there!<br>
> <br>
> Sorry for coming here with a technical question, but I would appreciate <br>
> if you could point me in the right direction.<br>
> <br>
> We experienced a bug in production a few times already and through <br>
> profiling we suspect it is an infinite loop here:<br>
> <a href="https://github.com/openjdk/jdk/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java#L475">
https://github.com/openjdk/jdk/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java#L475</a> <<a href="https://github.com/openjdk/jdk/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java#L475">https://github.com/openjdk/jdk/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java#L475</a>><br>
> <br>
> I came here before opening a bug report, because I'm not sure I am <br>
> right. We haven't been able to reproduce the bug in a dev environment.<br>
> Before spending much more time trying to reproduce this, I was hoping <br>
> someone smarter could give me a hint if this is even the right direction.<br>
> <br>
> If no one here can help, I'd appreciate if you could point me in a <br>
> direction of somewhere where I could have a casual discussion about <br>
> this, or get some more eyes on this.<br>
> <br>
> Thank you very much.<br>
> <br>
> -- ​Marko<br>
> <br>
> <br>
>        <br>
> <br>
> *Marko Bakšić*<br>
> <br>
> Software Engineer<br>
> <br>
>        <br>
> <br>
> *E *Marko.Baksic@infobip.com<br>
> <br>
> *M*<br>
> <br>
>        <br>
> <br>
> *A *Utinjska 29A, 10000 Zagreb, Croatia<br>
> <br>
> www.infobip.com<<a href="http://www.infobip.com">http://www.infobip.com</a>><br>
> <br>
> <<a href="https://www.infobip.com/news/infobip-named-to-fast-companys-annual-list-of-the-worlds-most-innovative-companies-of-2024">https://www.infobip.com/news/infobip-named-to-fast-companys-annual-list-of-the-worlds-most-innovative-companies-of-2024</a>><br>
> <br>
> <<a href="https://www.facebook.com/infobip">https://www.facebook.com/infobip</a>>
<br>
> <<a href="https://www.linkedin.com/company/infobip">https://www.linkedin.com/company/infobip</a>>
<br>
> <<a href="https://twitter.com/Infobip">https://twitter.com/Infobip</a>>  <<a href="https://www.instagram.com/infobip/">https://www.instagram.com/infobip/</a>>
<br>
> <<a href="https://www.youtube.com/channel/UCUPSTy53VecI5GIir3J3ZbQ">https://www.youtube.com/channel/UCUPSTy53VecI5GIir3J3ZbQ</a>><br>
> <br>
> *GSMA Associate Member*<br>
> This email message and any attachments are intended solely for the use <br>
> of the addressee. If you are not the intended recipient, you are <br>
> prohibited from reading, disclosing, reproducing, distributing, <br>
> disseminating or otherwise using this transmission. If you have received <br>
> this message in error, please promptly notify the sender by reply email <br>
> and immediately delete this message from your system. This message and <br>
> any attachments may contain information that is confidential, privileged <br>
> or exempt from disclosure. Delivery of this message to any person other <br>
> than the intended recipient is not intended to waive any right or privilege.<br>
> <br>
<br>
</div>
</span></font></div>
</body>
</html>