RFR : JDK-8204661 - Show error 'Port already in use' in HashedPasswordFileTest.java

Daniel D. Daugherty daniel.daugherty at oracle.com
Thu Jun 21 13:58:08 UTC 2018


 > Port number of 0 is not handled at JMX or RMI layer. The given port 
number is passed onto the ServerSocket.
 >
 > 
https://docs.oracle.com/javase/10/docs/api/java/net/ServerSocket.html#%3Cinit%3E(int) 


Using a port number of 0 to get a free port has to be done very carefully
to avoid running into other, more difficult to find issues.

Jerry T. fix a few of these before he left us:

     JDK-8182757 JDWP: Socket Transport handshake hangs on Solaris
     https://bugs.openjdk.java.net/browse/JDK-8182757

     JDK-8178676 nsk/jvmti/AttachOnDemand/attach045 fails with Exception
     https://bugs.openjdk.java.net/browse/JDK-8178676

     JDK-8188867 
nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004
                 (and other tests) timeout do to socket problem
     https://bugs.openjdk.java.net/browse/JDK-8188867


As an example of the difficulty, I tried to fix this bug:

     JDK-8182307 Error during JRMP connection establishment
     https://bugs.openjdk.java.net/browse/JDK-8182307

and had to back out my fix because it caused a couple of tests to fail.
I'm tracking the redo here:

     JDK-8193227 [REDO] 8182307 Error during JRMP connection establishment
     https://bugs.openjdk.java.net/browse/JDK-8193227

and I haven't had an epiphany for how to fix it without breaking
other tests (yet) so I just decommitted it from JDK11.


I'm not saying that your current fix will be susceptible to very
intermittent hangs on Solaris. I would have to take a very close
look at it and I haven't done that yet.

Dan


On 6/21/18 2:47 AM, Harsha Wardhana B wrote:
>
>
> On Thursday 21 June 2018 10:30 AM, mandy chung wrote:
>>
>>
>> On 6/20/18 1:14 AM, Harsha Wardhana B wrote:
>>> Hi,
>>>
>>> Please find the fix below for the bug
>>>
>>> JDK-8204661 : Show error 'Port already in use' in 
>>> HashedPasswordFileTest.java
>>>
>>> having webrev at,
>>>
>>> http://cr.openjdk.java.net/~hb/8204661/webrev.00/
>>>
>>> The problem root-cause is discussed in the comments section of the bug.
>>>
>>> The fix above lets the default agent pick a free port by passing 
>>> 'port=0' value and then reads the JMX Connector URL from Perf Counters.
>>
>> This looks fine.  Please add this issue number to @bug.
>>
>> This is interesting.  I was not aware of setting port=0 will 
>> auto-assign a free port.  Do you know if it was added for testing 
>> purpose (which I assume so)?
> Port number of 0 is not handled at JMX or RMI layer. The given port 
> number is passed onto the ServerSocket.
>
> https://docs.oracle.com/javase/10/docs/api/java/net/ServerSocket.html#%3Cinit%3E(int) 
>
>
>>
>> For example 
>> test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java 
>> uses jdk.testlibrary.Utils.getFreePort() to get a free port number.
>>
>> Mandy
> Harsha
>



More information about the serviceability-dev mailing list