JDK-8295275 : java/net/httpclient/ProxyAuthDisabledSchemes.java failed with "IOException: Unable to establish loopback connection"
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 20
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-10-13
  • Updated: 2024-09-11
  • Resolved: 2024-09-11
Related Reports
Relates :  
Relates :  
Relates :  
Description
The following test failed in the JDK20 CI:

java/net/httpclient/ProxyAuthDisabledSchemes.java

Here's a snippet from the log file:

FINE [Oct 13, 1:02:01.403857700] sun.net.httpserver.ServerImpl logReply: POST /foo/ HTTP/1.1 [200  OK] ()
FINE [Oct 13, 1:02:01.408862500] sun.net.httpserver.ServerImpl$Exchange run: Exchange request line: POST /foo/ HTTP/1.1
FINE [Oct 13, 1:02:01.408862500] sun.net.httpserver.ServerImpl logReply: POST /foo/ HTTP/1.1 [200  OK] ()
java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
	at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:497)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.create(HttpClientImpl.java:426)
	at java.net.http/jdk.internal.net.http.HttpClientBuilderImpl.build(HttpClientBuilderImpl.java:143)
	at DigestEchoClient.newHttpClient(DigestEchoClient.java:227)
	at DigestEchoClient.testDigest(DigestEchoClient.java:549)
	at DigestEchoClient.main(DigestEchoClient.java:302)
	at ProxyAuthDisabledSchemes.main(ProxyAuthDisabledSchemes.java:54)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
	at java.base/java.lang.Thread.run(Thread.java:1591)
Caused by: java.io.IOException: Unable to establish loopback connection
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:103)
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:67)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:204)
	at java.base/sun.nio.ch.WEPollSelectorImpl.<init>(WEPollSelectorImpl.java:79)
	at java.base/sun.nio.ch.WEPollSelectorProvider.openSelector(WEPollSelectorProvider.java:33)
	at java.base/java.nio.channels.Selector.open(Selector.java:295)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.<init>(HttpClientImpl.java:1014)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:494)
	... 10 more
Caused by: java.net.BindException: Address already in use: connect
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Net.java:580)
	at java.base/sun.nio.ch.Net.connect(Net.java:587)
	at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:880)
	at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:285)
	at java.base/sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:138)
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:85)
	... 18 more
TestServer(2): stopping 2 connections
TestServer(1): stopping 4 connections
TestServer(1): finished
TestServer(2): finished
java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
	at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:497)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.create(HttpClientImpl.java:426)
	at java.net.http/jdk.internal.net.http.HttpClientBuilderImpl.build(HttpClientBuilderImpl.java:143)
	at DigestEchoClient.newHttpClient(DigestEchoClient.java:227)
	at DigestEchoClient.testDigest(DigestEchoClient.java:549)
	at DigestEchoClient.main(DigestEchoClient.java:302)
	at ProxyAuthDisabledSchemes.main(ProxyAuthDisabledSchemes.java:54)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:125)
	at java.base/java.lang.Thread.run(Thread.java:1591)
Caused by: java.io.IOException: Unable to establish loopback connection
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:103)
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:67)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:204)
	at java.base/sun.nio.ch.WEPollSelectorImpl.<init>(WEPollSelectorImpl.java:79)
	at java.base/sun.nio.ch.WEPollSelectorProvider.openSelector(WEPollSelectorProvider.java:33)
	at java.base/java.nio.channels.Selector.open(Selector.java:295)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.<init>(HttpClientImpl.java:1014)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:494)
	... 10 more
Caused by: java.net.BindException: Address already in use: connect
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Net.java:580)
	at java.base/sun.nio.ch.Net.connect(Net.java:587)
	at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:880)
	at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:285)
	at java.base/sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:138)
	at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:85)
	... 18 more

JavaTest Message: Test threw exception: java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
----------rerun:(49/6703)*----------
Comments
This is only an issue for platforms where Unix Domain Socket are not available. In that case, the Selector needs to open a private socket on the loopback address. We can't do anything but fail if the system refuses to open/bind/connect that socket due to lack of system resources.
11-09-2024

The observed exception occurs on platform where Unix Domain Sockets are not available. See JDK-8280944.
13-10-2022

yes - it's the same problem than JDK-8266900 actually (different test but same root cause)
13-10-2022

There's another unresolved bug for the same test: JDK-8262294 java/net/httpclient/ProxyAuthDisabledSchemes.java fails with HTTP/1.1 parser received no bytes The failures modes are very different.
13-10-2022