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

Socket to literal ipv6 address fails

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 7u79
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_79"
      Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

      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 :
      Darwin 2guns.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      a working ipv6 network connection

      A DESCRIPTION OF THE PROBLEM :
      This code:

       // www.google.com address
      InetAddress adr = InetAddress.getByName("2a00:1450:4008:800::1010");
      Socket socket = new Socket(adr, 22);

      throws this:
      java.net.NoRouteToHostException: No route to host
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at java.net.Socket.connect(Socket.java:538)
      at java.net.Socket.<init>(Socket.java:434)
      at java.net.Socket.<init>(Socket.java:244)

      This only happens on macos x not on linux or windows. And please don't ask about that if
      my network is work, it is, i proofed it with telnet. There are no socks or proxies configured,
      i stepped with the debugger to the nativ connect call and this throws the exception but receives
      the right data (address,port)
      It only happens if a literal ipv6 address is used.

      REGRESSION. Last worked in version 8u25

      ADDITIONAL REGRESSION INFORMATION:
      it also failed on macos with jre 7_45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      package test;

      import java.net.InetAddress;
      import java.net.Socket;

      public class Test {
      public static void main(String[] args) throws Exception {
                      // www.google.com address
      InetAddress adr = InetAddress.getByName("2a00:1450:4008:800::1010");
      Socket socket = new Socket(adr, 80);
              }
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no exception
      ACTUAL -
      java.net.NoRouteToHostException: No route to host
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at java.net.Socket.connect(Socket.java:538)
      at java.net.Socket.<init>(Socket.java:434)
      at java.net.Socket.<init>(Socket.java:244)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.net.InetAddress;
      import java.net.Socket;

      public class Test {
      public static void main(String[] args) throws Exception {
                      // www.google.com address
      InetAddress adr = InetAddress.getByName("2a00:1450:4008:800::1010");
      Socket socket = new Socket(adr, 80);
              }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      no known, i try a could of ipv6 related options, no difference.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: