Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'll start out with an appology for the off topic post. Reap me if I'm too off topic. I know of no other place to ask.
I'm running a moderate sized Perl/CGI script that I wrote on an Apache server. About 60% of the time, when it is spawned, it will leave a "defunct" process that eats up a large chunk of CPU cycles for about a second, to the point where it is causing problems for other applications on the same box.
I'm running with strict and warnings, I have cleaned up all the warnings and am properly exitting.
Any insight would be appreciated. Thanks!
Re: OT: Defunct & Killing the Server
by Anonymous Monk on Dec 20, 2001 at 03:31 UTC
|
I just realized that I used CGI.pm in my "Hello World" test. I just tried it manually printing the headers, no defuncts. I added use CGI;, and I got a few defuncts.
Could it be the beloved CGI.pm causing the problems!? I'm using version 2.76.
| [reply] [d/l] |
|
I had some problems earlier with CGI.pm's "offline" mode running as a child process. if it helps at all I foud that a wrapper script was running the perl code on the command line and redirecting the output to apache.
| [reply] |
Re: OT: Defunct & Killing the Server
by hydo (Monk) on Dec 20, 2001 at 03:13 UTC
|
What platform is this and are you using DBI?
There used to be an issue with DBI and Oracle 7 but the chances of this applying to you are probably slim. So actually, could you post your platform and what modules you are using? It would narrow this down considerably =)
| [reply] |
|
Linux (I'm pretty sure its Debian) I am using DBI, but with mySQL. Other notable modules are CGI and CGI::Debug. Hosted by Apache Advanced Extranet Server.
Even a simple "Hello world" script, when refresh is pressed quickly and repeatedly, generates defunct processes.
| [reply] |
|
Might be time to look for another hosting provider. A defunct process is a process that has exited but still has an entry in the kernels process table. In most unices it has no size other than the sizeof() the entry itself. There is one unix variant that does store some resident information about the process other than its table entry but I cant remember which one offhand. This should not kill the server unless there are so many of them that they fill the process table in which case all fork()s will return errors until there is space for thier new processes in the table.
Are these processes exiting after a while or are they staying around? These processes are normal in that all processes besides init become defunct when they exit() and are cleaned from the process table by init or the kernel. Logic would then suggest that the cleaner-upper (very technical term there) isn't doing its job. =)
So if I were you, I would look for another hosting provider.
| [reply] |
|