# Service elasticsearch stop is not stopping the process

**URL:** <https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044>\
**Category:** Elasticsearch\
**Created:** [May 1, 2023, 10:27pm UTC](https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044 "2023-05-01T22:27:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swati\_Bourai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swati_bourai/32/117703_2.png) [@Swati\_Bourai](https://discuss.elastic.co/u/Swati_Bourai)\
**Post date:** [May 1, 2023, 10:27pm UTC](https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044/1 "2023-05-01T22:27:13Z")

</div>

We are trying to stop elastic using the service elasticsearch stop command however not sure how it further calls the kill command as there is no execstop command in the elasticsearch.service file

Also we see the process keeps on running but pid file is removed.

```auto
elastic 2596439 1 1 Apr18 ? 04:00:04 /path/shared/pathElasticsearch8-1.0.SNAPSHOT/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j2.formatMsgNoLookups=true -Djava.locale.providers=SPI,COMPAT --add-opens=java.base/java.io=ALL-UNNAMED -XX:+UseG1GC -Djava.io.tmpdir=/tmp/elasticsearch-18329529858296199006 -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m -XX:HeapDumpPath=logs -Xms7913m -Xmx7913m -XX:MaxDirectMemorySize=4150263808 -XX:G1HeapRegionSize=4m -XX:InitiatingHeapOccupancyPercent=30 -XX:G1ReservePercent=15 -Des.distribution.type=tar --module-path /path/config/elasticsearch8/nodes/dev01/lib --add-modules=jdk.net -m org.elasticsearch.server/org.elasticsearch.bootstrap.Elasticsearch
elastic 2601266 1 1 Apr18 ? 04:43:47 /path/config/kibana8/bin/../node/bin/node /path/config/kibana8/bin/../src/cli/dist

```

checking the service

```auto
 service pathElasticsearch8 status
Redirecting to /bin/systemctl status pathElasticsearch8.service
● pathElasticsearch8.service - Elasticsearch8
   Loaded: loaded (/etc/systemd/system/pathElasticsearch8.service; enabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) since Mon 2023-04-24 17:11:36 BST; 1 weeks 0 days ago
  Process: 4154989 ExecStop=/path/config/elasticsearch8/bin/elasticsearch stop (code=exited, status=0/SUCCESS)
 Main PID: 2596439 (java)
    Tasks: 117 (limit: 101037)
   Memory: 8.9G
   CGroup: /system.slice/pathElasticsearch8.service
           └─2596439 /path/shared/pathElasticsearch8-1.0.SNAPSHOT/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.>

```

We have to hard kill the process every time can someone please explain the reasonz.

Below is the error during shutdown of the elasticsearch8

````auto
[2023-04-24T17:11:36,299][INFO][o.e.x.w.WatcherService] [dev01] stopping watch service, reason [shutdown initiated]
[2023-04-24T17:11:36,300][INFO][o.e.x.w.WatcherLifeCycleService] [dev01] watcher has stopped and shutdown
[2023-04-24T17:11:36,577][INFO][o.e.c.c.Coordinator] [dev01] master node [{dev03}{R9mOUc7AQ52Z4tAVNVWbSA}{b8Hc4HjGRyWhnT3YSKqmQw}{dev03}{57.255.232.170}{57.255.232.170:9310}{cdfhlmrstw}] disconnected, restarting discovery
[2023-04-24T17:11:36,584][INFO][o.e.x.m.p.l.CppLogMessageHandler] [dev01] [controller/2596473] [Main.cc@176] ML controller exiting
[2023-04-24T17:11:36,583][ERROR][i.n.u.c.D.rejectedExecution] [dev01] Failed to submit a listener notification task. Event loop shut down?
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setContextClassLoader")
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:485) ~[?:?]
        at java.security.AccessController.checkPermission(AccessController.java:1068) ~[?:?]
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:411) ~[?:?]
        at java.lang.Thread.setContextClassLoader(Thread.java:1525) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor$2.run(GlobalEventExecutor.java:226) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor$2.run(GlobalEventExecutor.java:223) ~[?:?]
        at java.security.AccessController.doPrivileged(AccessController.java:318) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor.startThread(GlobalEventExecutor.java:223) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor.execute0(GlobalEventExecutor.java:211) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor.execute(GlobalEventExecutor.java:205) ~[?:?]
        at io.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:841) ~[?:?]
        at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:499) ~[?:?]
        at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:616) ~[?:?]
        at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:605) ~[?:?]
        at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:96) ~[?:?]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:1057) ~[?:?]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[2023-04-24T17:11:36,587][INFO][o.e.x.m.p.NativeController] [dev01] Native controller process has stopped - no new native processes can be started
[2023-04-24T17:11:46,580][WARN][o.e.c.c.ClusterFormationFailureHelper] [dev01] master not discovered or elected yet, an election requires at least 2 nodes with i
```
````

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 2, 2023, 3:54am UTC](https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044/2 "2023-05-02T03:54:16Z")

</div>

Welcome to our community! 😃

Please share your Elasticsearch logs, it might help us identify the issue.

---

<div class="post-metadata">

**Author:** ![Swati\_Bourai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swati_bourai/32/117703_2.png) [@Swati\_Bourai](https://discuss.elastic.co/u/Swati_Bourai)\
**Post date:** [May 2, 2023, 1:25pm UTC](https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044/3 "2023-05-02T13:25:55Z")

</div>

thanks have shared the logs.🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 30, 2023, 1:26pm UTC](https://discuss.elastic.co/t/service-elasticsearch-stop-is-not-stopping-the-process/332044/4 "2023-05-30T13:26:01Z")

</div>

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