Skip to content

Commit

Permalink
Switch to debug with server=n (#48188)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alpar-t authored Oct 21, 2019
1 parent 652bda7 commit 832ddb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions TESTING.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Boolean getDebug() {

@Override
public void beforeStart() {
int debugPort = 8000;
int debugPort = 5005;
int httpPort = 9200;
int transportPort = 9300;
Map<String, String> additionalSettings = System.getProperties().entrySet().stream()
Expand All @@ -57,7 +57,7 @@ public void beforeStart() {
"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;
}
}
Expand Down

0 comments on commit 832ddb3

Please sign in to comment.