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

jshell does not start with an IPv6 address

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      paul@sprocket:~$ lsb_release -a
      No LSB modules are available.
      Distributor ID: Debian
      Description: Debian GNU/Linux 11 (bullseye)
      Release: 11
      Codename: bullseye
      paul@sprocket:~$

      paul@sprocket:~$ java -version
      openjdk version "11.0.14" 2022-01-18
      OpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1deb11u1)
      OpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1deb11u1, mixed mode, sharing)
      paul@sprocket:~$

      paul@sprocket:~$ readlink -f `which jshell`
      /usr/lib/jvm/java-11-openjdk-amd64/bin/jshell
      paul@sprocket:~$

      paul@sprocket:~$ dpkg -S /usr/lib/jvm/java-11-openjdk-amd64/bin/jshell
      openjdk-11-jdk-headless:amd64: /usr/lib/jvm/java-11-openjdk-amd64/bin/jshell
      paul@sprocket:~$

      paul@sprocket:~$ jshell -version
      jshell 11.0.14
      paul@sprocket:~$

      Note that, on my system, "localhost" resolves to the following list of IP address:
          `::1` (an IPv6 address),
          `127.0.0.1` (an IPv4 address).

      A DESCRIPTION OF THE PROBLEM :
      Specifying the `java.net.preferIPv6Addresses` system configuration property as either `true` or `system` causes jshell to report a stack-trace and die.

      The value of `system` may depend on the OS configuration; in particular, whether the OS (itself) is configured to prefer IPv6 addresses.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run either:

          jshell -J-Djava.net.preferIPv6Addresses=true

      or

          jshell -J-Djava.net.preferIPv6Addresses=system

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect jshell to show a prompt and support REPL-like interaction.
      ACTUAL -
      paul@sprocket:~$ jshell -J-Djava.net.preferIPv6Addresses=system
      Launching JShell execution engine threw: FailOverExecutionControlProvider: FAILED: 0:jdi:hostname(0:0:0:0:0:0:0:1) --
        Exception: java.lang.InternalError: Failed remote listen: java.lang.IllegalArgumentException: unable to parse port number in address @ com.sun.jdi.SocketListen (defaults: timeout=, port=, localAddress=) -- {timeout=timeout=5000, port=port=, localAddress=localAddress=0:0:0:0:0:0:0:1}
                        jdk.jshell/jdk.jshell.execution.JdiInitiator.reportLaunchFail(JdiInitiator.java:300)
                        jdk.jshell/jdk.jshell.execution.JdiInitiator.listenTarget(JdiInitiator.java:199)
                        jdk.jshell/jdk.jshell.execution.JdiInitiator.<init>(JdiInitiator.java:111)
                        jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:103)
                        jdk.jshell/jdk.jshell.execution.JdiExecutionControlProvider.generate(JdiExecutionControlProvider.java:152)
            cause: java.lang.IllegalArgumentException: unable to parse port number in address
      FailOverExecutionControlProvider: FAILED: 1:jdi:launch(true) --
        Exception: java.net.SocketTimeoutException: Accept timed out
                        java.base/java.net.PlainSocketImpl.socketAccept(Native Method)
                        java.base/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:474)
                        java.base/java.net.ServerSocket.implAccept(ServerSocket.java:565)
                        java.base/java.net.ServerSocket.accept(ServerSocket.java:533)
                        jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:116)
      FailOverExecutionControlProvider: FAILED: 2:jdi --
        Exception: java.net.SocketTimeoutException: Accept timed out
                        java.base/java.net.PlainSocketImpl.socketAccept(Native Method)
                        java.base/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:474)
                        java.base/java.net.ServerSocket.implAccept(ServerSocket.java:565)
                        java.base/java.net.ServerSocket.accept(ServerSocket.java:533)
                        jdk.jshell/jdk.jshell.execution.JdiDefaultExecutionControl.create(JdiDefaultExecutionControl.java:116)

      paul@sprocket:~$

      A similar result is obtained by specifying java.net.preferIPv6Addresses has the value `true`

      ---------- BEGIN SOURCE ----------
      The source code for jshell is part of the JDK repo (see, for example, jdk11u repo).
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      By default if `java.net.preferIPv6Addresses` is not specified then Java will prefer IPv4 addresses.

      jshell starts up correctly if "localhost" resolves to an IPv4 address (e.g., '127.0.0.1')

      FREQUENCY : always


            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: