mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
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:
parent
652bda7c3e
commit
832ddb36f5
2 changed files with 8 additions and 2 deletions
|
@ -43,6 +43,12 @@ supports a remote debugging option:
|
||||||
./gradlew run --debug-jvm
|
./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
|
==== Distribution
|
||||||
|
|
||||||
By default a node is started with the zip distribution.
|
By default a node is started with the zip distribution.
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class RunTask extends DefaultTestClustersTask {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeStart() {
|
public void beforeStart() {
|
||||||
int debugPort = 8000;
|
int debugPort = 5005;
|
||||||
int httpPort = 9200;
|
int httpPort = 9200;
|
||||||
int transportPort = 9300;
|
int transportPort = 9300;
|
||||||
Map<String, String> additionalSettings = System.getProperties().entrySet().stream()
|
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 {}",
|
"Running elasticsearch in debug mode, {} suspending until connected on debugPort {}",
|
||||||
node, 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;
|
debugPort += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue