[9] RFR: 8159038: javax/net/ssl/SSLSession/SessionCacheSizeTests.java failed with java.net.SocketException: Address already in use
Artem Smotrakov
artem.smotrakov at oracle.com
Mon Jun 13 22:25:20 UTC 2016
Hello,
Please review this patch for 9.
javax/net/ssl/SSLSession/SessionCacheSizeTests.java test fails
intermittently with "java.net.SocketException: Address already in use"
exception. This exception occurs while creating a server socket:
...
void doServerSide(int serverPort, int serverConns) throws Exception {
try (SSLServerSocket sslServerSocket =
(SSLServerSocket) sslssf.createServerSocket(serverPort)) {
...
, where "serverPort" comes from "serverPorts" array which is originally
initialized with zeros.
The code looks correct to me, and I don't see how "serverPort" may have
non-zero value, so that it can point to a busy port. If "Address already
in use" error occurs when zero is passed to
SSLServerSocketFactory.createServerSocket() then it looks like a bug there.
Passing "serverPort" to doServerSide() and startServer() methods looks
redundant. doServerSide() method can just pass zero to
SSLServerSocketFactory.createServerSocket() method.
The patch updates the test to use a zero constant when it creates a
server socket. As I mentioned earlier, and if I am not missing
something, the code looks correct to me, this change is to make sure
that zero is passed to there. Any other suggestions are very welcome.
It also updates the test to print some additional output, and to use
try-with-resources and try-finally blocks.
Bug: https://bugs.openjdk.java.net/browse/JDK-8159038
Webrev: http://cr.openjdk.java.net/~asmotrak/8159038/webrev.00/
Artem
More information about the security-dev
mailing list