Night of the Living Dead Processes

Sean Casey sean at ms.uky.edu
Fri Jan 20 21:02:49 AEST 1989


I'm having problems with Zombies...

I've been installing a bunch of games around here. Some of them are
networked multiplayer games, and I wanted a way to list all the users of
them. For reasons I won't go into, I implemented this as a program that is
from within the games in question. It is run whenever a player is added, and
it is run whenever a player leaves. A global database is then updated that
players can gets reports from via a program.

The code fragment to run my program looks like:

{
	pidbuf[8];
	sprintf(pidbuf, "%d", getpid());
	if (vfork() == 0) {
		execl(my program etc etc etc args);
		exit(-1);
	}
}

Unfortunately, the programs in question have one or more INET sockets
open, and the child inherits the descriptors. When the child exits, some
part of the connection hangs, and the child wakes from the dead, goes out,
and eats brains. That is, it becomes <defunct>.

I'm moderately familiar with INET sockets. The sockets are being
SO_NOLINGER-ed and may or may not have data pending at the point of
the vfork().

I've tried a bulk closing of any and all file descriptors after vfork
to no avail. Is there any way to really NAIL a file descriptor? To
say close_dammit_I_really_want_to_exit(fd)? I consider it rude to fill
up the process table with shambling corpses.

Sean
-- 
***  Sean Casey                        sean at ms.uky.edu,  sean at ukma.bitnet
***  Who sometimes never learns.       {backbone site|rutgers|uunet}!ukma!sean
***  U of K, Lexington Kentucky, USA  ..where Christian movies are banned.
***  ``There's only TWO THINGS come out of Oklahoma...''



More information about the Comp.unix.wizards mailing list