Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I'm making zombie processes.

0 views
Skip to first unread message

Gregory L. Hansen

unread,
Dec 15, 2003, 2:24:59 PM12/15/03
to

I've been trying out a script that rejects incoming mail with virus
attachments, and the system administrator complained that it's not
exiting properly. She said there were all these sendmails running my
process as a child, and she had to stop sendmail and delete my zombie
processes.

How do I even make a zombie process? Why would a script not exit
properly?


--
"The preferred method of entering a building is to use a tank main gun
round, direct fire artillery round, or TOW, Dragon, or Hellfire missile to
clear the first room." -- THE RANGER HANDBOOK U.S. Army, 1992

Erik Max Francis

unread,
Dec 15, 2003, 2:45:12 PM12/15/03
to
"Gregory L. Hansen" wrote:

> I've been trying out a script that rejects incoming mail with virus
> attachments, and the system administrator complained that it's not
> exiting properly. She said there were all these sendmails running my
> process as a child, and she had to stop sendmail and delete my zombie
> processes.
>
> How do I even make a zombie process? Why would a script not exit
> properly?

It means you're spinning off a child process and not properly waiting
for it to die in the parent, via one of the wait... calls (wait, wait3,
wait4, waitpid).

--
__ Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ To be refutable is not the least charm of a theory.
-- Friedrich Nietzsche

Gregory L. Hansen

unread,
Dec 15, 2003, 3:22:34 PM12/15/03
to
In article <3FDE0F48...@alcyone.com>,

Erik Max Francis <m...@alcyone.com> wrote:
>"Gregory L. Hansen" wrote:
>
>> I've been trying out a script that rejects incoming mail with virus
>> attachments, and the system administrator complained that it's not
>> exiting properly. She said there were all these sendmails running my
>> process as a child, and she had to stop sendmail and delete my zombie
>> processes.
>>
>> How do I even make a zombie process? Why would a script not exit
>> properly?
>
>It means you're spinning off a child process and not properly waiting
>for it to die in the parent, via one of the wait... calls (wait, wait3,
>wait4, waitpid).

I'm not doing it intentionally. I'm not forking or dinking around with
anything except files in my own home directories, using some mundane
unix utilities like sed, grep, cmp. I thought each command was waiting
for the preceeding one before it begins.

Could there be a problem with quitting while something is still being
written to disk? Like toward the end I have a

cat tmpmail.$$ >> $inbox

then remove some tmp files (they don't always seem to remove reliably) and
exit.

Would a simple wait at the end solve it?

--
"I'm giving you the chance to look fate in those pretty eyes of hers
and say, 'Step off, bitch. This is my party and you're not invited.'"
-- Chris Shugart, _Testosterone Magazine_

Erik Max Francis

unread,
Dec 16, 2003, 12:39:54 AM12/16/03
to
"Gregory L. Hansen" wrote:

> Would a simple wait at the end solve it?

I'd have to see the script to see specifically what it might be. Are
you throwing anything in the background (&)? Are you running anything
that might fork into the background without you knowing it?

You might want to ask your sysadmin what the names of the processes are
that end up being zombies to help you track it down.

--
__ Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE

\__/ Patriotism is the virtue of the vicious.
-- Oscar Wilde

Gregory L. Hansen

unread,
Dec 16, 2003, 10:41:29 AM12/16/03
to
In article <3FDE9AAA...@alcyone.com>,

Erik Max Francis <m...@alcyone.com> wrote:
>"Gregory L. Hansen" wrote:
>
>> Would a simple wait at the end solve it?
>
>I'd have to see the script to see specifically what it might be.

It's longish. Would it be appropriate to post it?

>Are
>you throwing anything in the background (&)?

Nope.

>Are you running anything
>that might fork into the background without you knowing it?

I've had enough learning experiences now that I think I don't know what
the hell I'm doing. I'm starting think it might be easier to write things
in C; it would involve more work to recreate tools that already exist,
but at least I'd know what they're doing.

>
>You might want to ask your sysadmin what the names of the processes are
>that end up being zombies to help you track it down.
>
>--
> __ Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
>/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
>\__/ Patriotism is the virtue of the vicious.
> -- Oscar Wilde

Tim Haynes

unread,
Dec 16, 2003, 10:55:21 AM12/16/03
to
glha...@steel.ucs.indiana.edu (Gregory L. Hansen) writes:

> anything except files in my own home directories, using some mundane unix
> utilities like sed, grep, cmp. I thought each command was waiting for the
> preceeding one before it begins.

Grep, awk and sed will revert to stdin if their input-file-list is empty.
This could happen as the result of e.g. a glob-expansion becoming an empty
list:

| zsh/scr, potato 3:53PM temp/ % grep foo nothing*matches*this
[big long pause for stuff to come in from /dev/stdin]

Could you be falling foul of a variation on this, somehow?

As has already been mentioned, getting details like a process-tree output
of the offending zombies, would be kinda good.

~Tim
--
Move a mountain / Fill the ground |pig...@stirfried.vegetable.org.uk
Take death on wheels / Re-create the land |http://spodzone.org.uk/

Erik Max Francis

unread,
Dec 16, 2003, 7:05:02 PM12/16/03
to Gregory L. Hansen
"Gregory L. Hansen" wrote:

> It's longish. Would it be appropriate to post it?

Probably not, but you can email it to me.

> I've had enough learning experiences now that I think I don't know
> what
> the hell I'm doing. I'm starting think it might be easier to write
> things
> in C; it would involve more work to recreate tools that already exist,
> but at least I'd know what they're doing.

Nah, it's almost certain that if you could write it in a shell script
then a shell script is the right tool to use. (If there was some part
of it you simply couldn't write or was horrendously inefficient in
shell, you probably wouldn't be where you are right now.)

You wouldn't use an M16 when all you need is a toothpick; choosing the
right tool for the job is important, especially in programming.

--
__ Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE

\__/ It is impossible to love and be wise.
-- Francis Bacon

Michael Paoli

unread,
Dec 18, 2003, 11:42:24 AM12/18/03
to
glha...@steel.ucs.indiana.edu (Gregory L. Hansen) wrote in message news:<brl1qb$nji$1...@hood.uits.indiana.edu>...

> I've been trying out a script that rejects incoming mail with virus
> attachments, and the system administrator complained that it's not
> exiting properly. She said there were all these sendmails running my
> process as a child, and she had to stop sendmail and delete my zombie
> processes.
>
> How do I even make a zombie process? Why would a script not exit
> properly?

Failing to reap one's dead children leads to zombies, and
init is "the father of all processes".
(Gotta love that UNIX terminology.)

When a child dies (e.g. exit(3), exit(2) or is otherwise terminated),
the the return/exit status of the child becomes available to the parent
(parent also receives SIGCHLD to notify it of death of child). The
child persists as a zombie until the parent reaps the dead child (via
wait(2) or similar call).

Note also that init (PID 1) conveniently reaps any zombies which it
directly inherits (i.e. if init becomes the parent of a zombie, it
reaps the zombie).

0 new messages