[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"><serguei.spitsyn@oracle.com></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"><daniil.x.titov@oracle.com></a>, Alex \
Menkov
<a class="moz-txt-link-rfc2396E" \
href="mailto:alexey.menkov@oracle.com"><alexey.menkov@oracle.com></a>, \
serviceability-dev
<a class="moz-txt-link-rfc2396E" \
href="mailto:serviceability-dev@openjdk.java.net"><serviceability-dev@openjdk.java.net></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"><daniil.x.titov@oracle.com></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"><alexey.menkov@oracle.com></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> > Resending with the corrected subject ...</pre>
<pre> > </pre>
<pre> > Hi Alex,</pre>
<pre> > </pre>
<pre> > Yes, you are right, class JstatdTest has the code that is \
supposed to handle the "port in use"</pre>
<pre> > case but at least for this specific test \
(sun/tools/jstatd/TestJstatdPort.java) it doesn't work.</pre> <pre> > \
</pre>
<pre> > Since there are multiple tests in sun/tools/jstatd/* \
folder that use this class and different ports</pre>
<pre> > might be subject to the "port in use" error and taking \
into account that it's hard to reproduce such case</pre>
<pre> > I found it safer to leave the original code and just \
augment it with what was missing for this specific</pre>
<pre> > case rather than completely replacing it.</pre>
<pre> > </pre>
<pre> > Best regards,</pre>
<pre> > Daniil</pre>
<pre> > </pre>
<pre> > On 3/16/20, 4:02 PM, "Alex Menkov" <a \
href="mailto:alexey.menkov@oracle.com" \
moz-do-not-send="true"><alexey.menkov@oracle.com></a> wrote:</pre> <pre> \
> </pre> <pre> > Hi Daniil,</pre>
<pre> > </pre>
<pre> > Looks like the test is supposed to handle "port in \
use" issue (see lines</pre> <pre> > 103-114).</pre>
<pre> > I suppose in case "port in use" jstatd exits, \
but</pre>
<pre> > ProcessTools.startProcess() continue to wait for \
"jstatd started" message.</pre> <pre> > </pre>
<pre> > --alex</pre>
<pre> > </pre>
<pre> > On 03/16/2020 12:00, Daniil Titov wrote:</pre>
<pre> > > Please review the change [1] that fixes the \
intermittent failure of the test.</pre> <pre> > ></pre>
<pre> > > 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> > > It doesn't \
happen.</pre> <pre> > ></pre>
<pre> > > 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> > > at \
jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:205)</pre>
<pre> > > at \
jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:133)</pre>
<pre> > > at \
jdk.test.lib.process.ProcessTools.startProcess(ProcessTools.java:254)</pre>
<pre> > > at \
jdk.test.lib.thread.ProcessThread$ProcessRunnable.xrun(ProcessThread.java:153)</pre>
<pre> > > at \
jdk.test.lib.thread.XRun.run(XRun.java:40)</pre> <pre> > > \
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> > > at \
jdk.test.lib.thread.TestThread.run(TestThread.java:123)</pre> <pre> > \
></pre>
<pre> > > Testing: Mach5 tests for sun/tools/jstatd/ \
successfully passed. Tier1-tier3 tests are still in progress.</pre> <pre> \
> ></pre> <pre> > > [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> > > [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> > ></pre>
<pre> > > Thank you,</pre>
<pre> > > Daniil</pre>
<pre> > ></pre>
<pre> > ></pre>
<pre> > ></pre>
<pre> > </pre>
<pre> > </pre>
<pre> > </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