When a zombie gets reparented due to the parent exit, send SIGCHLD to
the reaper. The traditional reaper init(8) is aware of zombies silently reparented to it after the parents exit, it loops around waitpid(2) to collect them. For other reapers, the silent reparenting is surprising and collecting zombies requires a thread blocking in waitpid(2) just for that purpose. It seems that sending second SIGCHLD is a better workaround than forcing all reapers to obey the setup. Reported by: Michael Zuo <muh.muhten@gmail.com>, jilles PR: 213928 Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
This commit is contained in:
parent
5a1842a24a
commit
545d312293
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309886
@ -455,6 +455,11 @@ exit1(struct thread *td, int rval, int signo)
|
||||
|
||||
if (!(q->p_flag & P_TRACED)) {
|
||||
proc_reparent(q, q->p_reaper);
|
||||
if (q->p_state == PRS_ZOMBIE) {
|
||||
PROC_LOCK(q->p_reaper);
|
||||
pksignal(q->p_reaper, SIGCHLD, q->p_ksi);
|
||||
PROC_UNLOCK(q->p_reaper);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Traced processes are killed since their existence
|
||||
|
Loading…
Reference in New Issue
Block a user