[jboss-jira] [JBoss JIRA] (WFCORE-4845) Allow Remote Debug Connections on Java 9+ With StandaloneCommandBuilder
James Perkins (Jira)
issues at jboss.org
Wed Feb 12 17:54:00 EST 2020
[ https://issues.redhat.com/browse/WFCORE-4845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Perkins reassigned WFCORE-4845:
-------------------------------------
Assignee: (was: Jeff Mesnil)
> Allow Remote Debug Connections on Java 9+ With StandaloneCommandBuilder
> -----------------------------------------------------------------------
>
> Key: WFCORE-4845
> URL: https://issues.redhat.com/browse/WFCORE-4845
> Project: WildFly Core
> Issue Type: Enhancement
> Components: Launcher
> Reporter: Josh Fisher
> Priority: Minor
>
> When using StandaloneCommandBuilder#setDebug method to set the debug VM argument it will use this format:
> -agentlib:jdwp=transport=dt_socket,server=y,suspend=$suspend,address=$debugPort
> On Java 9+, this will only accept connections from the localhost, while in Java 8 this will accept connections from any host. It is possible to support remote connections on Java 9+ by configuring the argument in the Java options list instead of using setDebug as a workaround.
> While debug connections from remote hosts are not especially common, there are some use cases where it may be desired. For consistency between Java versions, we should consider using the wildcard "*" host so the debug argument format is:
> -agentlib:jdwp=transport=dt_socket,server=y,suspend=$suspend,address=*:$debugPort
>
> I believe one way this could be achieved is by modifying the DEBUG_FORMAT to:
> DEBUG_FORMAT = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=%s,address=%s"
> then in setDebug check the environment VM and format the address accordingly.
> {code:java}
> public StandaloneCommandBuilder setDebug(boolean suspend, int port) {
> final String address;
> if (environment.getJvm().isModular()){
> address = "*:" + port;
> } else {
> address = String.valueOf(port);
> }
> debugArg = String.format(DEBUG_FORMAT, (suspend ? "y" : "n"), address);
> return this;
> }
> {code}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list