On Thu, May 06, 2004 at 10:55:14AM -0600, Brian Hirt wrote:
> 
> On May 6, 2004, at 10:27 AM, Perrin Harkins wrote:
> 
> >On Wed, 2004-05-05 at 22:11, Brian Hirt wrote:
> >>I've been running across a problem lately where a child process
> >>terminates because of an out of memory error.   It prints Out of 
> >>Memory
> >>once, the the process sucks up all available cpu print "Callback 
> >>called
> >>exit." to the log file until it hit's it's 2GB max size.
> >
> >I'm just guessing here, but this is probably because apache is trying 
> >to
> >spawn new processes, and they keep dying because there's no memory.
> >
> 
> Thanks for the response, interesting insight into the history of $^M.
> 
>  When I've seen this happen, it's the same PID spewing the messages, 
> there are no forkings going on.   The system isn't actually out of 
> memory, and there is plenty of it available for the parent httpd 
> process to fork.    The child process has an rlimit set which is why 
> it's getting an out of memory error.  I initially set the rlimit, 
> because at one point in the past the ImageMagick module would every now 
> and then go crazy and consume all available memory which would bring 
> down everything.

Yes, thanks as well.  I didn't know how ineffective that was, and am
glad I wasn't setting aside too much memory for it.

Brian, if you can trigger the OOM and "Callback called exit" loop,
would you try my example mod_perl_startup.pl and use this at the end:

## Importing CGI::Carp sets $main::SIG{__DIE__} = \&CGI::Carp::die;
## Override that to additionally give a stack backtrace
$main::SIG{__DIE__} = sub { undef $M; &CGI::Carp::confess; };


The 'undef $M' will mark the memory as unused (as long as nothing
else has a reference to it), and if Perl garbage collection kicks
in before the looping problem, then you might have some memory to
work with.  I don't know the threshold offhand that Perl uses to
trigger freeing the memory back to the system when using the
system malloc, but a couple of MBs would most likely do it.

Of course, this assumes that the loop is occurring somewhere after
die() is called, and after this routine is called.  Worth a shot...

Cheers,
Glenn

-- 
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

Reply via email to