[9]RFR JDK-8160029: Security-libs tests need to avoid using jdk.testlibrary.Utils.getFreePort()

Wang Weijun weijun.wang at oracle.com
Sat Jul 9 10:04:30 UTC 2016


I am not sure. If in the first round a free port is chosen for UDP but it's not available for TCP, how can we avoid the same port being chosen again in the 2nd round? The DatagramSocket object is closed in the catch block and the port number is reclaimed by the OS. Will the OS reuse it immediately in the 2nd round?

--Max

> On Jul 9, 2016, at 3:18 PM, John Jiang <sha.jiang at oracle.com> wrote:
> 
> Hi Max,
> 
> On 2016/7/8 16:19, Wang Weijun wrote:
>> The reason a loop is needed here is that both the TCT and UDP servers must listen on the same port number. With your fix, the TCP server finds a free port, but I doubt if it's free for the UDP server.
> Yes, it's possible that the port still be occupied by another DatagramSocket.
> Please review the updated webrev: http://cr.openjdk.java.net/~jjiang/8160029/webrev.01
> 
> Best regards,
> John Jiang
> 
>> 
>> --Max
>> 
>> 
>>> On Jul 8, 2016, at 2:35 PM, John Jiang <sha.jiang at oracle.com> wrote:
>>> 
>>> Hi,
>>> Would you like to review this patch for removing unnecessary usages on jdk.testlibrary.Utils.getFreePort() from security-libs tests?
>>> In OpenJDK, I find only sun/security/krb5/auto/KDC.java should be modified for this issue.
>>> If I miss something, please let me know.
>>> 
>>> Issue: https://bugs.openjdk.java.net/browse/JDK-8160029
>>> Webrev: http://cr.openjdk.java.net/~jjiang/8160029/webrev.00
>>> 
>>> Thanks!
>>> 
>>> John Jiang
>>> 
>>> 
>> 
> 




More information about the security-dev mailing list