Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247996

HttpClient.newHttpClient() throws java.lang.InternalError with VPN or firewall

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 10.0.18363 Build 18363
      Java 14.0.1

      A DESCRIPTION OF THE PROBLEM :
      Using some VPNs or firewalls on Windows, it is impossible to create a HttpClient, because it seems to attempt to connect to some loopback address immediately.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call HttpClient.newHttpClient() on a machine while running a VPN or firewall that blocks _all_ connections.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some instance of HttpClient is returned
      ACTUAL -
      Exception in thread "Main" java.lang.InternalError: java.io.IOException: Unable to establish loopback connection
              at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:313)
              at java.net.http/jdk.internal.net.http.HttpClientImpl.create(HttpClientImpl.java:255)
              at java.net.http/jdk.internal.net.http.HttpClientBuilderImpl.build(HttpClientBuilderImpl.java:135)
              at java.net.http/java.net.http.HttpClient.newHttpClient(HttpClient.java:158)
              ...
      Caused by: java.io.IOException: Unable to establish loopback connection
              at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:94)
              at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:61)
              at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
              at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:171)
              at java.base/sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50)
              at java.base/java.nio.channels.Pipe.open(Pipe.java:155)
              at java.base/sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:142)
              at java.base/sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44)
              at java.base/java.nio.channels.Selector.open(Selector.java:295)
              at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.<init>(HttpClientImpl.java:710)
              at java.net.http/jdk.internal.net.http.HttpClientImpl.<init>(HttpClientImpl.java:310)
              ... 46 more
      Caused by: java.net.ConnectException: Connection refused: connect
              at java.base/sun.nio.ch.Net.connect0(Native Method)
              at java.base/sun.nio.ch.Net.connect(Net.java:503)
              at java.base/sun.nio.ch.Net.connect(Net.java:492)
              at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:751)
              at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:194)
              at java.base/sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:127)
              at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:76)
              ... 56 more

      ---------- BEGIN SOURCE ----------
      public static void main(String args[]) {
          java.net.http.HttpClient.newHttpClient();
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Disable VPN or firewall

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michaelm Michael McMahon
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: