Switch to debug with server=n (#48188)

Before this change one needed to re-start debugging several times, as we
launched multiple JVMs in debug mode.
With this option the IDE has the option to re-launch and listen for
connections again leading for to a more pleasant experience.
This commit is contained in:
Alpar Torok 2019-10-21 15:06:03 +03:00
parent 1a42e37070
commit 7d085ffbd9
2 changed files with 8 additions and 2 deletions

View File

@ -43,6 +43,12 @@ supports a remote debugging option:
./gradlew run --debug-jvm
---------------------------------------------------------------------------
This will instruct all JVMs (including any that run cli tools such as creating the keyring or adding users)
to suspend and initiate a debug connection on port incrementing from 5005.
As such the IDE needs to be instructed to listen for connections on this port.
Since we might run multiple JVMs as part of configuring and starting the cluster it's
recommended to have the option to aut restart checked.
==== Distribution
By default a node is started with the zip distribution.

View File

@ -36,7 +36,7 @@ public class RunTask extends DefaultTestClustersTask {
@Override
public void beforeStart() {
int debugPort = 8000;
int debugPort = 5005;
int httpPort = 9200;
int transportPort = 9300;
Map<String, String> additionalSettings = System.getProperties().entrySet().stream()
@ -57,7 +57,7 @@ public class RunTask extends DefaultTestClustersTask {
"Running elasticsearch in debug mode, {} suspending until connected on debugPort {}",
node, debugPort
);
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=" + debugPort);
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=" + debugPort);
debugPort += 1;
}
}