[TUHS] self-reproducing programs
dot at dotat.at
Fri Mar 25 00:24:22 AEST 2016
Not quite a fork bomb...
I was deploying some new software on a production server. (There wasn't a
good place to test it.) I somehow screwed up the restart logic so it
continuously restarted itself. The process forked, the parent exited, and
the child looped to restart again. There was only ever one instance of the
program running, but its pid changed hundreds of times per second.
Since it had daemonized, I couldn't use process groups to kill it.
Since it was running as root, I couldn't use `kill -TERM -1` to kill just
one user's processes.
Since it was a production server, I reslly didn't want to reboot.
I tried picking a pid somewhat larger than the program's rapidly
increasing pid, and ran a script: while !kill $pid; do :; done
No dice, it just blew straight past.
I wrote a C program to kill that one pid even faster. Still no luck.
In the end I managed to kill it by running about 5 or 10 concurrent copies
of my C program on a set of adjacent pids.
Only fallout was a few FTP server connection failures...
f.anthony.n.finch <dot at dotat.at> http://dotat.at/ - I xn--zr8h punycode
Lundy, Fastnet, Irish Sea: Southwest 5 to 7, veering northwest, then backing
southwest later, 4 or 5. Moderate or rough, becoming slight in Irish Sea. Rain
for a time. Good, becoming moderate or poor for a time.
More information about the TUHS