From 832ddb36f59e9dfbbd7ebc97376e533d8b2e7e93 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Mon, 21 Oct 2019 15:06:03 +0300 Subject: [PATCH] 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. --- TESTING.asciidoc | 6 ++++++ .../java/org/elasticsearch/gradle/testclusters/RunTask.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/TESTING.asciidoc b/TESTING.asciidoc index e9279c3c7ce4..3b0dcebcf0f6 100644 --- a/TESTING.asciidoc +++ b/TESTING.asciidoc @@ -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. diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/RunTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/RunTask.java index 1512e9f2cf73..129c74df7276 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/RunTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/RunTask.java @@ -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 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; } }