[teststabilization] RFR: 8223638: Replace wildcard address with loopback or local host in tests - part 6

Daniel Fuchs daniel.fuchs at oracle.com
Mon May 13 15:45:03 UTC 2019


Hi Aleksei,

I believe that some configurations in the wild might
return you the external host address when looking up
"localhost". It doesn't matter if the server binds to
the wildcard, but if you change the server to stop using
the wildcard, then you also need to change the client to
use the same address that the server binds too.

AcceptCauseFileDescriptorLeak.java:

I believe line
   97                         (new Socket("localhost", 
ss.getLocalPort())).close();

should be changed to use the loopback address.


UnreferencedSockets.java:

same remark as above:

  130         Socket s = new Socket("localhost", svr.localPort());

PerConnectionProxy.java:

same remark as above:

   97                 InetSocketAddress isa = 
InetSocketAddress.createUnresolved("localhost", pserver.getPort());

Redirect307Test.java:

should use URIBuilder here:

  108         URL url = new URL("http://localhost:" + port);

RedirectLimit.java:

  113         URL url = new URL("http://localhost:" + port);

should use URIBuilder.

MultiReleaseJarHttpProperties.java:

   69                 new URL("http://localhost:" + server.getPort() + 
"/multi-release.jar")

should use URIBuilder.

MultiReleaseJarURLConnection.java:

  171                 {"http", new URL("jar:http://localhost:" + 
server.getPort() + "/multi-release.jar!/")},
  172                 {"http", new URL("http://localhost:" + 
server.getPort() + "/multi-release.jar")},

Should use URIBuilder.

SimpleHttpServer.java:

a simpler change that keeps binding happening in
start() would be:

      private final HttpServer server;
+    private final InetAddress address;

      public SimpleHttpServer() throws IOException {
-        server = HttpServer.create();
+        this(null);
+    }
+
+    public SimpleHttpServer(InetAddress address) throws IOException {
+        address = addr;
+        server = HttpServer.create();
      }

      public void start() throws IOException {
-        server.bind(new InetSocketAddress(0), 0);
+        server.bind(new InetSocketAddress(address, 0), 0);

best regards,

-- daniel



On 13/05/2019 16:07, Aleks Efimov wrote:
> Hi,
> 
> Please help to review another part of test fixes to address 
> intermittent  networking test failures.
> 
> Webrev:
> http://cr.openjdk.java.net/~aefimov/8223638/00/index.html
> 
> JBS:
> https://bugs.openjdk.java.net/browse/JDK-8223638
> 
> With Best Regards,
> Aleksei
> 



More information about the net-dev mailing list