# ExecutionManager shutdown not killing process

**URL:** <https://forum.inductiveautomation.com/t/executionmanager-shutdown-not-killing-process/41950>\
**Category:** Ignition\
**Created:** [January 4, 2021, 9:33pm UTC](https://forum.inductiveautomation.com/t/executionmanager-shutdown-not-killing-process/41950 "2021-01-04T21:33:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpervaiz](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mpervaiz](https://forum.inductiveautomation.com/u/mpervaiz)\
**Post date:** [January 4, 2021, 9:33pm UTC](https://forum.inductiveautomation.com/t/executionmanager-shutdown-not-killing-process/41950/1 "2021-01-04T21:33:30Z")

</div>

I am running the function below executionManager.executeOnce(server::spawnExe):

```
public void spawnExe() {
    CommandLine cmdLine = CommandLine.parse(installedServerPath);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);

    DefaultExecutor executor = new DefaultExecutor();

    executor.setStreamHandler(streamHandler);
    int exitCode = 0;
    try {
        exitCode = executor.execute(cmdLine);
        logger.info("server is dying now");
        logger.info("server is dying now");
        logger.info("server is dying now");
        logger.info("server is dying now");
        logger.info("server is dying now");
        logger.info(String.format("exit code, %d", exitCode));

    } catch (IOException e) {
        logger.error(e.getStackTrace().toString());
    }

}

```

So the function is hanging during execution which is fine for me, but when i run the following during “public void shutdown()”:

executionManager.unRegisterAll(“myModule”);  
executionManager.shutdown();

The exe doesnt stop running…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 4, 2021, 10:20pm UTC](https://forum.inductiveautomation.com/t/executionmanager-shutdown-not-killing-process/41950/2 "2021-01-04T22:20:53Z")

</div>

`BasicExecutionEngine` just attempts to call `ExecutorService.shutdownNow()`, which per the Javadoc has no guarantee of actually stopping execution:  
[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ExecutorService.html#shutdownNow()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ExecutorService.html#shutdownNow())

If you’re calling out to a native process, you’ll need to guarantee its shutdown via some other mechanism.

---

<div class="post-metadata">

**Author:** ![mpervaiz](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mpervaiz](https://forum.inductiveautomation.com/u/mpervaiz)\
**Post date:** [January 6, 2021, 2:56pm UTC](https://forum.inductiveautomation.com/t/executionmanager-shutdown-not-killing-process/41950/3 "2021-01-06T14:56:33Z")

</div>

Ok, got it. Thanks for clarifying
