sean@ms.uky.edu (Sean Casey) (01/20/89)
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@ms.uky.edu, sean@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...''
root@chessene.UUCP (This System) (01/23/89)
In article <10927@s.ms.uky.edu> sean@ms.uky.edu (Sean Casey) writes:
[edited for television]
-I'm having problems with Zombies...
-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>.
Are you doing a wait() in the parent process? (It wasn't in the code fragment.)
If the process is <defunct>, then it's waiting to be waited for. If the problem
were the sockets not being closed, then the process would be <exiting>.
I might have my brain screwed in backwards today, but I'm pretty sure I haven't
gotten them mixed up.
--
Mark Buda Domain: hermit@chessene.uucp
Dumb: ...rutgers!bpa!vu-vlsi!devon!chessene!hermit
"Here, with a compressed air drill, parsnips are harvested." - an old newsreel
kjones@talos.UUCP (Kyle Jones) (01/23/89)
In article <10927@s.ms.uky.edu> sean@ms.uky.edu (Sean Casey) writes: >I'm having problems with Zombies... The problem is that your forked process has a living parent and that parent has not wait()ed for it. Therefore you get a zomby.