[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: 8240711: TestJstatdPort.java failed due to "ExportException: Port already in use:"
From:       "serguei.spitsyn () oracle ! com" <serguei ! spitsyn () oracle ! com>
Date:       2020-03-23 19:13:12
Message-ID: 5fb5bca9-8052-6168-042f-dc0b7192daa5 () oracle ! com
[Download RAW message or body]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 3/23/20 12:05, Daniil Titov wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1575A797-0E97-4473-B803-B3FBDA888B2A@oracle.com">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal">Hi Serguei,</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">In this case tryToSetupJstatdProcess() on
          line 346 return null and the test  will try to find a new pair
          of ports and start jstatd process.</p>
      </div>
    </blockquote>
    <br>
    I understand this.<br>
    My question if this loop can be endless.<br>
    What happens if there is no new pair of ports that we did not check
    yet?<br>
    Do we fail with a timeout in such a case?<br>
    If so, would it better to report that unused free port was not
    found?<br>
    Is it possible to detect this situation?<br>
    <br>
    Thanks,<br>
    Serguei<br>
     
    <blockquote type="cite"
      cite="mid:1575A797-0E97-4473-B803-B3FBDA888B2A@oracle.com">
      <div class="WordSection1">
        <p class="MsoNormal">Best regards,</p>
        <p class="MsoNormal">Daniil</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal"> </p>
        <div>
          <p class="MsoNormal"><b><span>From: </span></b><span><a \
class="moz-txt-link-rfc2396E" \
                href="mailto:serguei.spitsyn@oracle.com">"serguei.spitsyn@oracle.com"</a>
                
              <a class="moz-txt-link-rfc2396E" \
href="mailto:serguei.spitsyn@oracle.com">&lt;serguei.spitsyn@oracle.com&gt;</a><br>  \
<b>Date: </b>Monday, March 23, 2020 at 11:45 AM<br>  <b>To: </b>Daniil Titov
              <a class="moz-txt-link-rfc2396E" \
href="mailto:daniil.x.titov@oracle.com">&lt;daniil.x.titov@oracle.com&gt;</a>, Alex \
                Menkov
              <a class="moz-txt-link-rfc2396E" \
href="mailto:alexey.menkov@oracle.com">&lt;alexey.menkov@oracle.com&gt;</a>, \
                serviceability-dev
              <a class="moz-txt-link-rfc2396E" \
href="mailto:serviceability-dev@openjdk.java.net">&lt;serviceability-dev@openjdk.java.net&gt;</a><br>
  <b>Subject: </b>Re: RFR: 8240711: TestJstatdPort.java
              failed due to "ExportException: Port already in use:"</span></p>
        </div>
        <div>
          <p class="MsoNormal"> </p>
        </div>
        <div>
          <p class="MsoNormal">Hi Daniil,<br>
            <br>
            It looks Okay in general.<br>
            But I've got a question.</p>
          <pre> 329             while (jstatdThread == null) {</pre>
          <pre> 330                 if (!useDefaultPort) {</pre>
          <pre> 331                     port = \
String.valueOf(Utils.getFreePort());</pre>  <pre> 332                 }</pre>
          <pre> 333 </pre>
          <pre> 334                 if (!useDefaultRmiPort) {</pre>
          <pre> 335                     rmiPort = \
String.valueOf(Utils.getFreePort());</pre>  <pre> 336                 }</pre>
          <pre> 337 </pre>
          <pre> 338                 if (withExternalRegistry) {</pre>
          <pre> 339                     Registry registry = startRegistry();</pre>
          <pre> 340                     if (registry == null) {</pre>
          <pre> 341                         // The port is already in use. Cancel and \
try with a new one.</pre>  <pre> 342                         continue;</pre>
          <pre> 343                     }</pre>
          <pre> 344                 }</pre>
          <pre> 345 </pre>
          <pre> 346                 jstatdThread = tryToSetupJstatdProcess();</pre>
          <pre> 347             }</pre>
          <p class="MsoNormal"><br>
            What is going to happen if all ports that we try are already
            in use?<br>
            Does the test report this situation?<br>
            <br>
            Thanks,<br>
            Serguei<br>
            <br>
            <br>
            On 3/17/20 11:40, Daniil Titov wrote:</p>
        </div>
        <blockquote>
          <pre>Hi Alex,</pre>
          <pre> </pre>
          <pre>Please review a new version of the fix that removes the old version of \
the code that tried to handle the "port in use" case.</pre>  <pre> </pre>
          <pre>Testing: Mach5 tests for sun/tools/jstatd/  successfully passed 100 \
times.  Tier1-tier3 tests successfully passed. </pre>  <pre> </pre>
          <pre>[1] <a href="http://cr.openjdk.java.net/~dtitov/8240711/webrev.02" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dtitov/8240711/webrev.02</a>  \
                </pre>
          <pre>[2] <a href="https://bugs.openjdk.java.net/browse/JDK-8240711" \
moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8240711</a></pre>  \
<pre> </pre>  <pre>Thanks,</pre>
          <pre>Daniil</pre>
          <pre> </pre>
          <pre> </pre>
          <pre> </pre>
          <pre>On 3/16/20, 5:38 PM, "Daniil Titov" <a \
href="mailto:daniil.x.titov@oracle.com" \
moz-do-not-send="true">&lt;daniil.x.titov@oracle.com&gt;</a> wrote:</pre>  <pre> \
</pre>  <pre>    Hi Alex,</pre>
          <pre>    </pre>
          <pre>    Yes,  I did test the change by modifying  the test to use the RMI \
                port that is already in use</pre>
          <pre>    ( the stack trace in the original email was exact from this \
changed test) and then ensured that with the fix </pre>  <pre>    the such issue is \
properly handled.</pre>  <pre>    </pre>
          <pre>    I will send a new version of the webrev that removes the old \
version of the code that tried to handle the "port in use" case.</pre>  <pre>    \
</pre>  <pre>    Thanks!</pre>
          <pre>    </pre>
          <pre>    Best regards,</pre>
          <pre>    Daniil</pre>
          <pre>    </pre>
          <pre>    </pre>
          <pre>    </pre>
          <pre>    </pre>
          <pre>    On 3/16/20, 4:47 PM, "Alex Menkov" <a \
href="mailto:alexey.menkov@oracle.com" \
moz-do-not-send="true">&lt;alexey.menkov@oracle.com&gt;</a> wrote:</pre>  <pre>    \
</pre>  <pre>        I don't agree.</pre>
          <pre>        The code handles exact the same "port in use" case for the \
same tool.</pre>  <pre>        So it either works or doesn't.</pre>
          <pre>        And have 2 code blocks which suppose to do the same makes the \
                code messy.</pre>
          <pre>        BTW did you tested the change (I mean craft the test to get \
"port in </pre>  <pre>        use" error)?</pre>
          <pre>        </pre>
          <pre>        --alex</pre>
          <pre>        </pre>
          <pre>        On 03/16/2020 16:17, Daniil Titov wrote:</pre>
          <pre>        &gt; Resending with the corrected subject ...</pre>
          <pre>        &gt; </pre>
          <pre>        &gt; Hi Alex,</pre>
          <pre>        &gt; </pre>
          <pre>        &gt; Yes, you are right, class JstatdTest has the code that is \
                supposed to handle the "port in use"</pre>
          <pre>        &gt; case but at least for this specific test  \
(sun/tools/jstatd/TestJstatdPort.java) it doesn't work.</pre>  <pre>        &gt; \
                </pre>
          <pre>        &gt; Since there are multiple tests in sun/tools/jstatd/* \
                folder that use this class and different ports</pre>
          <pre>        &gt; might be subject to the "port in use" error and taking \
                into account that it's hard to reproduce such case</pre>
          <pre>        &gt; I found it safer to leave the original code and just \
                augment it with what was missing for this specific</pre>
          <pre>        &gt; case rather than completely replacing it.</pre>
          <pre>        &gt; </pre>
          <pre>        &gt; Best regards,</pre>
          <pre>        &gt; Daniil</pre>
          <pre>        &gt; </pre>
          <pre>        &gt; On 3/16/20, 4:02 PM, "Alex Menkov" <a \
href="mailto:alexey.menkov@oracle.com" \
moz-do-not-send="true">&lt;alexey.menkov@oracle.com&gt;</a> wrote:</pre>  <pre>       \
&gt; </pre>  <pre>        &gt;      Hi Daniil,</pre>
          <pre>        &gt;      </pre>
          <pre>        &gt;      Looks like the test is supposed to handle "port in \
use" issue (see lines</pre>  <pre>        &gt;      103-114).</pre>
          <pre>        &gt;      I suppose in case "port in use" jstatd exits, \
                but</pre>
          <pre>        &gt;      ProcessTools.startProcess() continue to wait for \
"jstatd started" message.</pre>  <pre>        &gt;      </pre>
          <pre>        &gt;      --alex</pre>
          <pre>        &gt;      </pre>
          <pre>        &gt;      On 03/16/2020 12:00, Daniil Titov wrote:</pre>
          <pre>        &gt;      &gt; Please review the change [1] that fixes the \
intermittent failure of the test.</pre>  <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      &gt; The problem here is that if the RMI port is in \
use than the test keep waiting for "jstatd started (bound to " to appear in the \
process output and in this case</pre>  <pre>        &gt;      &gt; It doesn't \
happen.</pre>  <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      &gt;         at \
java.util.concurrent.CountDownLatch.await(<a \
href="mailto:java.base@15-internal/CountDownLatch.java:232" \
                moz-do-not-send="true">java.base@15-internal/CountDownLatch.java:232</a>)</pre>
                
          <pre>        &gt;      &gt;         at \
                jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:205)</pre>
                
          <pre>        &gt;      &gt;         at \
                jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:133)</pre>
                
          <pre>        &gt;      &gt;         at \
                jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:254)</pre>
                
          <pre>        &gt;      &gt;         at \
                jdk.test.lib.thread.ProcessThread$ProcessRunnable.xrun(ProcessThread.java:153)</pre>
                
          <pre>        &gt;      &gt;         at \
jdk.test.lib.thread.XRun.run(XRun.java:40)</pre>  <pre>        &gt;      &gt;         \
at java.lang.Thread.run(<a href="mailto:java.base@15-internal/Thread.java:832" \
                moz-do-not-send="true">java.base@15-internal/Thread.java:832</a>)</pre>
                
          <pre>        &gt;      &gt;         at \
jdk.test.lib.thread.TestThread.run(TestThread.java:123)</pre>  <pre>        &gt;      \
                &gt;</pre>
          <pre>        &gt;      &gt; Testing: Mach5 tests for sun/tools/jstatd/ \
successfully passed.  Tier1-tier3 tests are still in progress.</pre>  <pre>        \
&gt;      &gt;</pre>  <pre>        &gt;      &gt; [1] <a \
href="http://cr.openjdk.java.net/~dtitov/8240711/webrev.01/" \
moz-do-not-send="true">http://cr.openjdk.java.net/~dtitov/8240711/webrev.01/</a></pre>
  <pre>        &gt;      &gt; [2] <a \
href="https://bugs.openjdk.java.net/browse/JDK-8240711" \
moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8240711</a></pre>  \
<pre>        &gt;      &gt;</pre>  <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      &gt; Thank you,</pre>
          <pre>        &gt;      &gt; Daniil</pre>
          <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      &gt;</pre>
          <pre>        &gt;      </pre>
          <pre>        &gt; </pre>
          <pre>        &gt; </pre>
          <pre>        </pre>
          <pre>    </pre>
          <pre> </pre>
          <pre> </pre>
        </blockquote>
        <p class="MsoNormal"><br>
          <br>
        </p>
      </div>
    </blockquote>
    <br>
  </body>
</html>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic