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

Receive a no route to host exception connecting to a host with an IPv6 Address.

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u45
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X Yosemite: Version 10.10.4 (14E46)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I'm on a network with full support for IPv6.

      A DESCRIPTION OF THE PROBLEM :
      Opening a socket to an IPv6-only host results in a 'No Route to Host' exception when instantiating a socket with either a host name or an IP address. I should note that I can ping the host, connect to the host with a web browser, and connect with sockets in other languages. Opening a socket with other programming languages results in a successful socket connection (tested in python). If instead of instantiating the socket with a hostname, i specify the IP address with the scope id of the interface appended (%4 for me on en0), the socket connects successfully and doesn't throw an exception.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You might have to try this with several configurations. For me this happens reliably on my wireless card (scope id %4), and works correctly on my wired card (scope id %13).

      1. Stage an host with only an IPv6 address on a network that supports IPv6.
      2. Instantiate a socket with the hostname of the target IPv6 host.
      3. If you're attempting this on the correct configuration, the socket will throw a 'No Route to Host' exception even if there is a route to the host.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The socket to connect successfully. This is what happens on the same computer with python as well as web browsers (written in c, c++, and objective c). Other languages can successfully connect.
      ACTUAL -
      The no route to host exception throws when I'm connected on my wireless adapter (scope id %4), but not when I'm connected on my wired adapter (scope id %13). This was attempted on several other computers with identical configurations. Reportedly, the socket successfully connected when a different user attempted this on java 1.6 after failing with an identical error message on the current version of java.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // This fails:

      try {
      Socket s = new Socket("your:ipv6:add:ress:here:0:39:0", 443);
      } catch (UnknownHostException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      // this succeeds

      try {
      Socket s = new Socket("your:ipv6:add:ress:here:0:39:0%4", 443);
      } catch (UnknownHostException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              robm Robert Mckenna
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: