Page MenuHomePhabricator

Try out Tree-Kill or Something Else as a More Sustainable Way to Kill Process Trees
Closed, ResolvedPublic

Description

Description

We should try an existing solution instead of rolling our own.

terminate doesn't work, but tree-kill or similar might.

Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • try out better-supported ways to kill process trees

Completion checklist

Event Timeline

root@3ed8d7dddc2f:/srv/service# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.6  0.2 1105088 74724 ?       Ssl  16:15   0:01 node server.js
root          17  0.1  0.0   4608  3712 pts/0    Ss   16:18   0:00 /bin/bash
root          25  0.1  0.1 724296 41088 ?        Ssl  16:18   0:00 node /srv/service/executor-classes/javaScriptWasmSubprocess.js
root          36  0.0  0.0   2576  1536 ?        S    16:18   0:00 /bin/sh -c . /srv/service/programming-languages/wasmedge/wasmedge-binary/env && wasmedge --enable-all-statistics --dir .:. --dir /executo
root          37 99.9  0.1 12746860 42556 ?      Sl   16:18   0:14 wasmedge --enable-all-statistics --dir .:. --dir /executors/javascript-wasmedge:./executors/javascript-wasmedge /srv/service/programming-
root          45  0.0  0.0   8480  4352 pts/0    R+   16:18   0:00 ps aux
root@3ed8d7dddc2f:/srv/service# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.7  0.2 1172928 77528 ?       Ssl  16:15   0:01 node server.js
root          17  0.1  0.0   4608  3712 pts/0    Ss   16:18   0:00 /bin/bash
root          36  0.0  0.0      0     0 ?        Z    16:18   0:00 [sh] <defunct>
root          37 97.0  0.0      0     0 ?        Z    16:18   0:15 [wasmedge] <defunct>
root          50  0.0  0.0   8480  4480 pts/0    R+   16:18   0:00 ps aux

tree-kill was not powerful enough to handle zombies

ps-node also fails, in an even worse way: it kills the two parent processes but leaves the wasmedge process itself running (in a non-zombie state, even).

nexpect might be useful to clean up the current solution, but I think the current strategy (kill the bottom-most process) might be the best we can do (without turning Docker into a full-on VM)

Jdforrester-WMF subscribed.

Is this being over-taken by the Rust work? I assume so, but let's leave this open until confirmed.

Is this being over-taken by the Rust work? I assume so, but let's leave this open until confirmed.

It is, indeed. Also, I've tried tree-kill, terminate, and a couple of other libraries. It appears that our solution is more stable (for our use case) than anything available in npm world. Closing.