Connection refused when attaching to java 9 process

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Wed Aug 29 18:41:46 UTC 2018


Hi Egor,

There were some security-related fixes pushed into jdk 9 by Dmitriy 
Samersoff.
You can try a workaround with the explicit IP address of the machine or 
with the asterisk like this:
   com.sun.jdi.SocketAttach:port=*:50327

The security fix was to require the IP address to be always explicit.
The *: can be used to restore the original behavior.

I've sent you more detailed reply in private.
Please, let me know if it helped.

Thanks,
Serguei


On 8/29/18 06:46, Egor Ushakov wrote:
> I was connecting from java 8 to java 9, it seems that in this 
> configuration it is not possible any more
>
>
> On 29-Aug-18 13:50, Egor Ushakov wrote:
>> this one I was able to overcome specifying the "hostname=127.0.0.1":
>>
>> >jdb -connect com.sun.jdi.SocketAttach:port=50327,hostname=127.0.0.1 
>> - works well now, though strange
>>
>> but ProcessAttach still does not work:
>>
>> >jdb -connect com.sun.jdi.ProcessAttach:pid=47844
>> java.net.ConnectException: Connection refused: connect
>>         at java.net.DualStackPlainSocketImpl.connect0(Native Method)
>>         at 
>> java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
>>
>>
>>
>> On 29-Aug-18 13:02, Egor Ushakov wrote:
>>> Hi,
>>>
>>> First, I'm aware about changes in jdk 9 attach "security" 
>>> (bugs.openjdk.java.net/browse/JDK-8175050 etc.).
>>> One specific case is still bothering me:
>>> I'm starting a process in server mode without specifying an address:
>>>
>>> >java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n my.Endless
>>> Listening for transport dt_socket at address: 50327
>>>
>>> so it auto select an address for me (which is what I want), but now 
>>> I'm unable to connect even from the same machine:
>>>
>>> >jdb -connect com.sun.jdi.SocketAttach:port=50327
>>> java.net.ConnectException: Connection refused: connect
>>>         at java.net.DualStackPlainSocketImpl.connect0(Native Method)
>>>         at 
>>> java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
>>> ...
>>>
>>> Is it possible to connect in this configuration?
>>>
>>> Thanks!
>>>
>>
>



More information about the serviceability-dev mailing list