logoalt Hacker News

tolcihoyesterday at 4:15 PM2 repliesview on HN

A `kill -9` will cause many a process to die and give no chance to cleanup any child processes. Some percentage of users continue to use `kill -9` by default, which may result in a mess of a process tree. Otherwise if the crash is bad enough that cleanup code cannot run (maybe it's being run on OpenBSD and an incompetent programmer didn't check the return value of a malloc and for some reason the kernel now nukes the process) then there may be orphan children. There may also be sporadic failures to cleanup if the crash, maybe, causes the whole process to exit before the cleanup code in some other thread can run. System load average may also influence how things maybe go sideways.


Replies

a_t48yesterday at 4:54 PM

That depends on how the children were spawned, no? prctl(PR_SET_PDEATHSIG, SIGTERM); or similar will fix this.

strogonoffyesterday at 4:52 PM

TIL. I didn’t know it’s the responsibility of the parent, thought OS automatically handles child processes.

show 1 reply