Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Dec 1997 15:57:29 +0100 (CET)
From:      pb@fasterix.frmug.org
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5236: CPU and mem not zeroed for zombie process
Message-ID:  <199712051457.PAA04190@ns.eu.org>
Resent-Message-ID: <199712051500.HAA02390@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         5236
>Category:       kern
>Synopsis:       CPU and mem not zeroed for zombie process
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec  5 07:00:03 PST 1997
>Last-Modified:
>Originator:     Pierre Beyssac
>Organization:
none
>Release:        FreeBSD 2.2.5-RELEASE i386
>Environment:

486DX50, 8 megs RAM.

>Description:

ps shows zombie processes left with non-zero %CPU and %MEM:

bash$ ps axuww
USER       PID %CPU %MEM   VSZ  RSS  TT  STAT STARTED       TIME COMMAND
pb        4076 78.4  0.1     0    0  p1  Z    -          0:00.00  (a.out)
...

The values stay stable while the zombie is in the process table.

>How-To-Repeat:

Compile the following code (trivial: forks, then the child uses
the CPU while the parent waits 10 minutes):

-------------------------------
#include <stdio.h>

int main()
{
	switch(fork()) {
	case -1:
		perror("fork");
		return 1;
	case 0:
		/* in child */
		for(;;);
		exit(0);
	default:
		/* in parent */
		sleep(600);
	}
	return 0;
}
-------------------------------

Run it:

$ ./a.out &
[1] 4075

Wait for the child to show-up with a reasonnable %CPU:

$ ps axuww | grep a.out
pb        4076 82.2  6.3   136  400  p1  R     3:46PM    0:05.60 ./a.out
pb        4075  0.0  6.4   136  404  p1  S     3:46PM    0:00.04 ./a.out

Kill the child:
$ kill 4076

Look at ps again:
pb        4076 78.4  0.1     0    0  p1  Z    -          0:00.00  (a.out)
pb        4075  0.0  0.0   136    0  p1  SW    3:46PM    0:00.04 ./a.out


>Fix:
	

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712051457.PAA04190>