Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUSTCOM-264 Client mode debugging (server=no) doesn't work with JDK>=9 #4633

Merged
merged 1 commit into from
May 12, 2020
Merged

CUSTCOM-264 Client mode debugging (server=no) doesn't work with JDK>=9 #4633

merged 1 commit into from
May 12, 2020

Conversation

jGauravGupta
Copy link
Contributor

@jGauravGupta jGauravGupta commented Apr 20, 2020

Description

This is a bug fix. Github ticket: #4619
Since Java 9 JDWP agent listens only local network interface by default so remote connections would be rejected. In this PR, If server mode is enabled then address port is prefixed with *: to enable remote connection. Unfortunately, the *: syntax is not backward compatible to Java 8 hence debug address requires an update on runtime.

Important Info

Testing

New tests

@Test
public void debugInClientMode() {
String DEBUG_CONFIG = "-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y";
Map<String, String> config = new HashMap<>();
config.put("debug-options", DEBUG_CONFIG);
JavaConfig javaConfig = new JavaConfig(config);
List<String> debugOptions = javaConfig.getDebugOptions();
Assert.assertEquals(DEBUG_CONFIG, debugOptions.get(0));
}
@Test
public void debugInServerMode() {
String DEBUG_CONFIG = "-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n";
Map<String, String> config = new HashMap<>();
config.put("debug-options", DEBUG_CONFIG);
JavaConfig javaConfig = new JavaConfig(config);
List<String> debugOptions = javaConfig.getDebugOptions();
if (JDK.getMajor() >= 9) {
Assert.assertEquals("-agentlib:jdwp=transport=dt_socket,address=*:9009,server=y,suspend=n", debugOptions.get(0));
} else {
Assert.assertEquals(DEBUG_CONFIG, debugOptions.get(0));
}
}

Testing Performed

Tested manually with IntelliJ IDEA 2020.1 patched with glassfishIntegration.jar on JDK8/11.

Testing Environment

Windows 10, JDK 11.0.3, JDK 1.8.0_172, IntelliJ IDEA 2020.1

@MattGill98
Copy link
Contributor

jenkins test please

@MattGill98 MattGill98 merged commit b02d754 into payara:master May 12, 2020
Pandrex247 pushed a commit to Pandrex247/Payara that referenced this pull request Jun 15, 2020
CUSTCOM-264 Client mode debugging (server=no) doesn't work with JDK>=9
@pzygielo
Copy link
Contributor

pzygielo commented May 15, 2024

I suppose this broke displaying debug info on start-domain --debug=true as the host part *: is not recognized by the pattern searching for port (alone) in address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client mode debugging (server=no) doesn't work with JDK>=9 /CUSTCOM-264
4 participants