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

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


Please review http://cr.openjdk.java.net/~jgish/Bug8006534-getUnusedRandomPort-retry-more/ <http://cr.openjdk.java.net/%7Ejgish/Bug8006534-getUnusedRandomPort-retry-more/>

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.

Thanks, Jim

-- 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