Current-Users archive

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

Re: Killing a zombie process?



On Thu, 1 Oct 2015, Paul Goyette wrote:

Even before that, you might want to check whether the process truly is
a zombie, or just dead - ps prints both as 'Z' - modifying (temporarily)
ps to show dead processes differently (maybe just z instead of Z) might
reveal that the zombie in question hasn't actually putrified yet, and is
just a corpse.

Interesting idea. I'm applying the following patch to ps/print.c so it will print a ZZ state for LSDEAD (vs only one Z for LSZOMB)

Index: print.c
===================================================================
RCS file: /cvsroot/src/bin/ps/print.c,v
retrieving revision 1.123
diff -u -p -r1.123 print.c
--- print.c     15 Nov 2014 01:58:34 -0000      1.123
+++ print.c     30 Sep 2015 22:44:08 -0000
@@ -513,6 +513,9 @@ state(void *arg, VARENT *ve, enum mode m
               *cp = 'O';
               break;

+       case LSDEAD:
+               *cp++ = 'Z';
+               /* FALLTHRU */
       case LSZOMB:
               *cp = 'Z';
               is_zombie = 1;

Well, I made the above change to ps, and re-ran some package builds.

I had previously gone to single-user and then back to multi-user, so the latest set of package builds started with zero zombies. I now have TWO zombie processes, both of whom are showing PPID==1, and onlhy a single "Z" in the STATE field. Furthermore, the builds are still running, so the sandbox's original /bin/sh process is still running, and both zombie processes are showing a "Z+" in the STATE field - both zombies are "... in the foreground process group of [their] control terminal" (quoting from the ps(1) man page).

I'm going to let the package builds finish, then I will have a look at the process structures and see if anything else looks interesting.



+------------------+--------------------------+-------------------------+
| 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