Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Sometimes processes aren't given a chance to cleanup their state before being killed. This happens when the kernel (Unix) receives a kill -9 command for a process, after which it immediately kills the process without any notification.

Processes spawned from node are pretty easy to zombify:

#create a file to listen on
touch /tmp/zombie.txt
var fs = require("fs");
var spawn = require("child_process").spawn;
/* create a "long running" process */"/tmp/zombie.txt", function(err, fd) {
  spawn("tail", ["-f"], {stdio: [fd, null, null]};
#issue a kill -9 to the node process so it doesn't have a chance to cleanup
killall -9 node
#verify "long running" process is now zombied
ps -A | grep tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment