# Unable to Kill the Process using EXEC Node in "Raspberry PI" though it is showing "KILLED"

**URL:** <https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924>\
**Category:** General\
**Created:** [14 November 2020 17:08 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924 "2020-11-14T17:08:44Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandy](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sandy](https://discourse.nodered.org/u/Sandy)\
**Post date:** [14 November 2020 17:08 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/1 "2020-11-14T17:08:44Z")

</div>

Hi All,  
In RaspberryPi, I used the EXEC node to run a Python script, and I able to Kill the EXEC node but the script is running background that is the script running process is not killed. We tried to find using Command Window, Then we found that there are two Process IDs (PID) are generating while I run the Command in EXEC node.  
How can I Kill two PIDs at a Time..? or  
Any command used to Kill the Process using EXEC node in Raspberry Pi..?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 November 2020 17:23 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/2 "2020-11-14T17:23:15Z")

</div>

Are you running a recent version of node-red? There was a problem fixed a few months ago to do with killing processes in the exec node. I suggest upgrading to the latest to see if it fixes it, unless that is a problem for you.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [14 November 2020 19:31 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/3 "2020-11-14T19:31:28Z")

</div>

What is the exact command you are executing? Kill can be quirky based on how the given process accepts signals (or not).

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 November 2020 21:46 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/4 "2020-11-14T21:46:15Z")

</div>

> [@Nodi.Rubrum](#):
>
> What is the exact command you are executing

I don't think she(?) is using a command, I assumed she was sending a Kill message to the Exec node.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [15 November 2020 03:51 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/5 "2020-11-15T03:51:58Z")

</div>

Oh, yeah... I was thinking CLI kill via exec node.

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [15 November 2020 09:39 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/6 "2020-11-15T09:39:09Z")

</div>

The fix was to use bash if available for the exec node on linux as dash which is symlinked to be the standard on some distributions doesn’t propagate the kill to the process group. So it would be interesting to know the version of nodered @Sandy is running. It would also be important to know what kind of python script you are running because there are some async python things which run detached and wont be killed if the spawning script dies i think. But its been a long time since I ve written any python code 🙈

Johannes

---

<div class="post-metadata">

**Author:** ![Sandy](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sandy](https://discourse.nodered.org/u/Sandy)\
**Post date:** [15 November 2020 13:18 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/8 "2020-11-15T13:18:01Z")

</div>

![one](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8a2cb45aa6a60b23e6abf7ff1a2a3c7c4ed8abdd.png)

SIGKILL is the command I used to kill. To be Specific I used "sudo python filename.py(with path)" to run the Script But The Process IDs are generating for "sudo python filename.py(with path)" along with other PID for the process "python filename.py(with path)" which is the default running background.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 November 2020 13:57 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/9 "2020-11-15T13:57:08Z")

</div>

And the answer to the questions about which version of node-red you are running?  
See at the bottom of the hamburger menu.

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [15 November 2020 17:06 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/12 "2020-11-15T17:06:47Z")

</div>

Ok just tested two simple python scripts one running threading with a daemon thread and another one running an asyncio task and I can kill either no problem with a `msg.kill` of **SIGTERM** both in exec and spawn mode in the latest nodered version. So please do tell us which version of nodered you have installed and if you are using the exec node in spawn or exec mode? You can find it easily here:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/6/e658e690357bde84b7ac0e9cfaaf94c348d165a1.jpeg)

---

<div class="post-metadata">

**Author:** ![Sandy](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sandy](https://discourse.nodered.org/u/Sandy)\
**Post date:** [16 November 2020 05:58 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/13 "2020-11-16T05:58:15Z")

</div>

![node_red version](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/25668373287eeb1473d6f5baf135b1e3abaee1e6.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 November 2020 07:25 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/14 "2020-11-16T07:25:17Z")

</div>

Did you see the suggestion that you upgrade to the latest node red version? You can do that by running the pi upgrade script from the node red docs.

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [16 November 2020 08:22 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/15 "2020-11-16T08:22:55Z")

</div>

> [@Colin](#):
>
> suggestion that you upgrade

I second this. I just had a look and the above mentioned fix wasn’t merged till node-red 1.1.0 so its likely that an update to a current nodered version would fix it.

---

<div class="post-metadata">

**Author:** ![Sandy](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@Sandy](https://discourse.nodered.org/u/Sandy)\
**Post date:** [10 December 2020 07:34 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/16 "2020-12-10T07:34:35Z")

</div>

Upgrading the **Node-Red Version** and using **Other Exec Node** where Command is **"sudo pkill python"**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 December 2020 07:34 UTC](https://discourse.nodered.org/t/unable-to-kill-the-process-using-exec-node-in-raspberry-pi-though-it-is-showing-killed/35924/17 "2020-12-24T07:34:54Z")

</div>

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