Re: mod_perl crashing / hanging
- Tom Schindl wrote:
> Alex Greg wrote:Hi,
>> Geoffrey Young wrote:
>> Thanks for your response. Sorry I wasn't clear; the httpd processes
>> don't actually kill the server, they just slow Apache right down to
>> the point at which it doesn't respond to requests any more. I am still
>> able to get onto the box and kill the processes etc. without having to
>> do a hard reboot or anything. My question is what's causing Apache to
>> get into the state where it can't fork any more shells from Perl.
>>>> This is because a shell call to date ($date = `date`;) is failing -
>>>> is most likely what's causing the failure to fork we see above.
>>> if you want to avoid that shell call try POSIX::strftime() instead.
>> We have quite a lot of calls via backticks throughout our code - and
>> not just for things like date that are trivially replaceable. Would
>> you recommend replacing these as far as possible?
> Yes because calling the shell is fairly slow if there are any
> perl-modules you could use these instead and it will certainly give you
> a performance boost.
> What calls do you make, are these custom programs? If not I'd take a
> look at CPAN maybe someone has already written a Perl-Module which does
> exactly what you need else you could maybe write it your own. I have
> done this for example librsvg because I wanted to avoid calls to the
> shell inside my httpd-processes.
We have some calls to ps that parse the output - I suppose we could
replace these with Proc::ProcessTable. The rest of it is just date, and
stuff that we can replace with either system() or Perl built-ins.
My concern though, is that this is a symptom of another problem, as has
been suggested earlier. I have activated mod_status, but since this
problem doesn't occur very often (and when it does, renders the server
unable to process requests, hence I won't be able to view the status),
I'm not sure how it will help. Looking at it now, I can see 7 servers in
state "Waiting for connection", and 4 in state "Sending reply", which I
assume is fairly normal.
I will keep watching this and start work on replacing the backticks. Any
further suggestions would be very much appreciated.
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html