Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Killing a zombie process?



I'm pretty much convinced that the p_nstopchild accounting is screwed up somewhere. I'm planning on adding the following code in "optimization" in kern_exit so I can catch it as soon as it happens.

Basically, if the optimization would cause us to stop looking for a process to report, this hack/patch will just scan the rest of the sibling list. If it finds a zombie that should be reported, it will panic, and I'll have pointers to both the zombie and the process at which the optimization occurred.

Comments?


Index: kern_exit.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_exit.c,v
retrieving revision 1.245
diff -u -p -r1.245 kern_exit.c
--- kern_exit.c 2 Oct 2015 16:54:15 -0000       1.245
+++ kern_exit.c 4 Oct 2015 09:15:00 -0000
@@ -788,6 +788,14 @@ find_stopped_child(struct proc *parent,
                                break;
                        }
                        if (parent->p_nstopchild == 0 || child->p_pid == pid) {
+/* XXX */
+                               struct proc *nxtchild = child;
+                               while (nxtchild = LIST_NEXT(nxtchild, p_sibling)
+                                       if (nxtchild->p_stat == SZOMB)
+                                               panic("Zombie %p not reaped - "
+                                                   "scan stopped at proc %p",
+                                                   nxtchild, child);
+/* XXX */
                                child = NULL;
                                break;
                        }



+------------------+--------------------------+-------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
+------------------+--------------------------+-------------------------+


Home | Main Index | Thread Index | Old Index