RFR: 8230220: java/net/HttpURLConnection/HttpURLProxySelectionTest.java fails intermittently

Daniel Fuchs daniel.fuchs at oracle.com
Tue Aug 27 11:19:23 UTC 2019


Hi Jaikiran,

Looks good.

While you're at it, would you mind using
jdk.test.lib.net.URIBuilder from the /test/lib
library instead of composing the URL string by hand?

Something like:

	URL targetURL = URIBuilder.newBuilder()
	    .scheme("http")
	    .host(server.getAddress().getAddress())
	    .port(server.getAddress().getPort())
	    .path(WEB_APP_CONTEXT)
	    .toURL();


I've come across some host configurations where:

InetAddress.getLoopbackAddress().getHostName() => "localhost"
but InetAddress.getByName("localhost") returns the external IP (and
not the loopback). It all depends on what is listed in /etc/hosts.

Using URIBuilder as above will ensure that the host address is
used (instead of the host name) and that "[" "]" are inserted
if the address is an IPv6 literal.

best regards,

-- daniel


On 27/08/2019 11:56, Jaikiran Pai wrote:
> Can I please get a review and a sponsor for a patch which fixes the
> issue noted in [1]? The patch is available as a webrev at [2].
> 
> This is a newly added testcase as part of a patch that I recently
> contributed for [3]. As noted by Daniel in [1], the intermittent failure
> is a result of a race condition in dealing with the member variables,
> used in the test, across 2 different threads.
> 
> [1] https://bugs.openjdk.java.net/browse/JDK-8230220
> 
> [2] http://cr.openjdk.java.net/~jpai/webrev/8230220/1/webrev/
> 
> [3] https://bugs.openjdk.java.net/browse/JDK-8177648
> 
> -Jaikiran
> 
> 



More information about the net-dev mailing list