How to stop Elasticsearch debugging gracefully

I'm novice in both Java and Elasticsearch, but assigned a task to implement an Elasticsearch plugin! :frowning:

After download the Elasticsearch source code and imported them in IntelliJ, I managed to debug the source code by:

gradle run --debug-jvm

Each time I want to stop debugging, I use Ctrl+C in the cmd windows. But when I try to debug again, the log says:

elasticsearch-5.1.1\distribution\build\cluster\run node0\elasticsearch-5.1.1-SNAPSHOT\data\nodes\0\indices\e9Xy2KDaRsGp_4qWaSJLfQ\0\index\_0.cfs

I have to kill the "Java(TM) Platform SE binary" task in the task manager. After this, run "gradle run --debug-jvm" gives another error:

:distribution:run#checkPrevious
jps -l
12432
11640 org.gradle.launcher.GradleMain
17464 sun.tools.jps.Jps

:distribution:run#checkPrevious FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':distribution:run#checkPrevious'.
> Could not find property 'pidFile' on task ':distribution:run#checkPrevious'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED 

I have to run "gradle clean & gradle assemble" to start debugging which will taks several minutes.

Am I wrong at any steps? Is there any method to stop debuggin gracefully?

Thanks very much!

Hm, I'm not sure. What IDE are you debugging in?

I normally stop the attached IDE first (IntelliJ in my case), then cmd-c the gradle task. Then I can gradle run --debug-jvm again with no problem.

Perhaps your IDE is still remaining connected (or attempting to) and causing problems?

Also:

This is perhaps a precarious thing to do :slight_smile: In general, we recommend people try to find solutions to their problem without resorting to native plugins. Plugins are difficult to maintain, we offer very little backwards compatibility guarantees for internal APIs, and can often lead to performance problems that are difficult to debug (e.g. is that memory leak due to Elasticsearch or the plugin?)

Thank you very much for your reply! Finally I solved this by deleting the "es.pid" file before debugging.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.