Enabling jdwp on a jdk 14 app results in Address family not supported by protocol error
Asked Answered
H

1

10

For a JDK 14 application, running on linux, adding the following JVM parameter

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

results in the following error

Starting Main...
ERROR: transport error 202: socket creation failed: Address family not supported by protocol
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [open/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:734]

Changing the address from *:5005 to localhost:5005 seems to work but then it's only bound to localhost. I know for a fact that *:5005 worked on JDK 12 and I can't find any changes regarding this, In fact JPDA spec still mentions the * option for jse 14 https://docs.oracle.com/en/java/javase/14/docs/specs/jpda/conninv.html. Anyone got any ideas what I can look into? Is it a bug or a feature for which I can't seem to find documentation for.

Herrick answered 18/9, 2020 at 12:24 Comment(1)
By default, jdwp agent tries to bind to [::]. Apparently, IPv6 does not work on your system. Try 0.0.0.0:5005 or add -Djava.net.preferIPv4Stack=true JVM option.Gitlow
H
16

As @apangin suggested in the comment. The solution is to specify the address as 0.0.0.0:5005 or to set the -Djava.net.preferIPv4Stack=true JVM parameter.

Herrick answered 5/10, 2020 at 7:57 Comment(1)
Since we increased the used tomcat jdk from ~8 to 11, it doesn't work anymore with address=5005. After changing it to adress=0.0.0.0:5005 it works again. Obviously there has been any default changed. Thank you!Normie

© 2022 - 2024 — McMap. All rights reserved.