From 5cbd6da4ddea895afd8ea928a13025d95841252c Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 13 Jun 2017 13:37:58 +0100 Subject: [PATCH] When stopping via systemd only kill the JVM, not its control group This prevents possible race conditions between the Elasticsearch JVM and plugin native controller processes that can cause the Elasticsearch shutdown to hang. The problem can happen when the JVM and the controller process receive a SIGTERM at almost the same time. (There's an assumption here that Elasticsearch will continue to use other mechanisms to kill native controller processes.) --- distribution/src/main/packaging/systemd/elasticsearch.service | 3 +++ 1 file changed, 3 insertions(+) diff --git a/distribution/src/main/packaging/systemd/elasticsearch.service b/distribution/src/main/packaging/systemd/elasticsearch.service index 4545706938512..623b41d7845b5 100644 --- a/distribution/src/main/packaging/systemd/elasticsearch.service +++ b/distribution/src/main/packaging/systemd/elasticsearch.service @@ -52,6 +52,9 @@ TimeoutStopSec=0 # SIGTERM signal is used to stop the Java process KillSignal=SIGTERM +# Send the signal only to the JVM rather than its control group +KillMode=process + # Java process is never killed SendSIGKILL=no