Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

defunct: the dead horse flogged.

by Kozz (Friar)
on Feb 19, 2002 at 15:14 UTC ( #146393=perlquestion: print w/replies, xml ) Need Help??

Kozz has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, most wise monks.

I've a question regarding defunct processes, specifically those of CGI scripts. I did a search AND a super-search and came across a few threads which seemed to relate to my problem, but none that truly answered my question.

I've got some perl scripts on a server, which, when it seems that the load grows high for some reason unrelated to my CGI scripts (most running as SSIs), all my SSI's start leaving dozens of <defunct> processes around.

I know from reading here that a defunct process is caused when a parent exits without waiting for its child. In this case, Apache is the parent, no? I guess I'm not sure what to do to prevent this. There's been some mild finger-pointing every time this poorly-administered server (IMO) yaks up a hairball and shows a high load that my CGI scripts are to blame because, after all, a quick 'ps aux' shows a ton of defunct scripts.

I've looked at putting the code in an eval block with alarm, but I've not worked with this much before. Will this method ensure that the script dies within $timeout? Or am I trying to patch the wrong problem here?

Thanks so much for your help.

Replies are listed 'Best First'.
Re: defunct: the dead horse flogged.
by Anonymous Monk on Feb 20, 2002 at 01:35 UTC
    If you are running your system on Sun/Solaris with Apache, you may want to check out this Apache bug. Turning on server-status in your httpd.conf may also be useful in tracking down possible causes.

    Hope this helps.

Re: defunct: the dead horse flogged.
by gellyfish (Monsignor) on Feb 20, 2002 at 12:25 UTC

    The defunct processes are the remains of processes whose parent hasn't called wait(3) on yet - they are not consuming any resources other than slots in the process table. A web server that is under high load might be spending more time processing new requests than waiting for it's children (your CGI programs). This can be further compounded if you are using a database engine that will spawn new processes as children of your CGI program for instance.

    I would throw the ball back in the court of the administrator of the server as it is probable that the servers hardware is not coping with the number of requests that is being asked of it.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://146393]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-12-05 05:56 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (25 votes). Check out past polls.