RFR: 8006534 CLONE - TestLibrary.getUnusedRandomPort() fails intermittently-doesn't retry enough times

Jim Gish jim.gish at oracle.com
Thu Jan 17 20:18:53 UTC 2013

Please review 

TestLibrary.getUnusedPort() attempts to retry getting an ephemeral port 
10 times, which is the current number of ports in the reserved port 
range.  Debugging code added a few weeks back has revealed that 
intermittent failures in tests using this method are caused when the 
underlying socket code first returns the first number in the reserved 
port range.  Subsequent retries result in incrementing the port number 
by one until reaching the max reserved port number, which just happens 
to correspond to the 10th attempt, and the code then quits trying.

The proposed fix (one of many possible alternatives, of course) simply 
retries for twice the number of ports in the range.


Jim Gish | Consulting Member of Technical Staff | +1.781.442.0304
Oracle Java Platform Group | Core Libraries Team
35 Network Drive
Burlington, MA 01803
jim.gish at oracle.com

More information about the core-libs-dev mailing list