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

REGRESSION: Remote debugging does not work on JDK 9

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P1 P1
    • 9
    • 9
    • core-svc
    • b15
    • generic
    • generic

      Unless there is something new in JDK 9 I'm unaware of, remote debugging of Java processes no longer works. Neither netbeans/jdb is able to connect to a server using an agentlib like this:

          -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5900

      I have duplicated this on Solaris/Linux/Windows, did not try Mac. On Solaris, this appears to have been introduced in JDK 9 b15.

      Using classpath (or modules), the debugger attach code fails on JDK 9 targets. This was originally found with netbeans 9, but jdb also does not work. If

      The simple example code is provided in an attachment. Instructions are in the doit shell script.

      Here's the output, sanitized for your protection:

      % 9/latest/binaries/solaris-sparcv9/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=5900
      Set uncaught java.lang.Throwable
      Set deferred uncaught java.lang.Throwable
      Initializing jdb ...

      VM Started: No frames on the current call stack

      main[1] main[1] quit

      % 9/latest/binaries/solaris-sparcv9/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=5900
      java.net.ConnectException: Connection refused (Connection refused)
              at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
              at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400)
              at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243)
              at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225)
              at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402)
              at java.base/java.net.Socket.connect(Socket.java:591)
              at jdk.jdi/com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:225)
              at jdk.jdi/com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
              at jdk.jdi/com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:85)
              at jdk.jdi/com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
              at jdk.jdi/com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
              at jdk.jdi/com.sun.tools.example.debug.tty.Env.init(Env.java:63)
              at jdk.jdi/com.sun.tools.example.debug.tty.TTY.main(TTY.java:1082)

      Fatal error:
      Unable to attach to target VM.
      %

      When snooping the connection at the TCP layer, a SYN is sent by the client, which receives a RST in response, which is usually an indication that the port wasn't opened.

            dsamersoff Dmitriy Samersoff
            wetmore Bradford Wetmore
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: