Re:When should I not kill -9 a process?
by IsTom on Saturday May 24, 2014 @06:28AM
(#7793053)
If a database is not kill -9 resistant then how can it be power-off resistant?
[ Parent
| on HN ]
There are ways to misdesign a system such that it is power-off robust but not kill -9 robust. The reason is that power-off means everything dies.
Postgres has special code to account for hard kills: it has a SYSV shared memory segment, to which every child attaches. If the parent dies, the children don't have a good way to know, so they might keep running. If you try to start a new postmaster and it sees that there are still processes attached to the shared memory segment (shm_nattch), it will fail to start.
Were it not for that code, it would allow you to start a new parent process, leading to chaos as two sets of backends were accessing the same files and shared memory without knowing about eachother.