-
Bug
-
Resolution: Not an Issue
-
P1
-
9
-
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.
-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.
- relates to
-
JDK-8043716 JDI test com/sun/jdi/ProcessAttachTest.sh and other 3 jdi tests failed in nightly
- Closed
-
JDK-8175313 JPDA documentation have to be updated to reflect changes for JDK-8041435
- Closed