Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Killing a zombie process?
On Wed, 30 Sep 2015, Robert Elz wrote:
Date: Wed, 30 Sep 2015 15:55:04 +0800 (PHT)
From: Paul Goyette <paul%vps1.whooppee.com@localhost>
Message-ID: <Pine.NEB.4.64.1509301551450.12641%vps1.whooppee.com@localhost>
| So there must be some difference in how init(8) waits during normal
| operation and how it waits during the transition to single-user.
Either that (which isn't really all that likely I'd guess) ...
Well, a quick read through sbin/init.c shows that sometimes it waits
with WNOHANG and sometimes it doesn't. I haven't figured out the actual
code-flow yet, so I can't tell if this accounts for the steady-state vs
transition-to-single-user difference or not.
... or perhaps
the process is not yet linked to init, so can't be waited upon. It
needs to be on init's child queue for wait to find it, regardless of
what the ppid has been set to.
Well, for the previous occurrence, I waited many hours, and the zombie
was still there. (It might even have been as much as a couple of days.)
In today's event, the 'shutdown' transition was run less than one hour
after the first notice, and at _that_ time the zombie was reaped. It
doesn't seem logical that the ppid gets set, but it gets enqueued only
after starting a shutdown.
I think I'd be checking out the sequence in the sys_exit() code, to see
if there's anything that happens, or could happen, between setting
the ppid to 1 and linking the process onto process 1's child list that
could perhaps block and cause the zombie to just sit there (for this,
once the process status is Z, you can't really trust some of the other
ps output, pid and ppid should be correct, but whan is unlikely to have
any meaning).
Yeah, I'll have a look at the sys_exit() code and see what I can find.
If I get really brave, I might even use gdb to attach to init(8) and see
which of the several waitpid() calls is active. (I'd prefer to do this
in a qemu VM, but then I'd need to reproduce the entire environment
inside the VM.)
+------------------+--------------------------+-------------------------+
| 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