[Catalyst] Memory leak under FastCGI?

John Goulah jgoulah at gmail.com
Mon Mar 31 14:01:26 BST 2008


On Mon, Mar 31, 2008 at 5:22 AM, Matthieu Codron <matthieu at codron.org> wrote:
> There was something about growing FastCGI processes in the Catalyst advent
> calendar:
>
> http://www.catalystframework.org/calendar/2007/18
>
> In short: Apparently this is normal behavior, and the article recommends
> you, like you suggested, to periodically restart fastcgi processes to keep
> memory usage reasonable.
>
>
>
> On 3/19/08, Matt Pitts <mpitts at a3its.com> wrote:
> > We have a Catalyst app that I recently (about a month ago) converted
> > from running under mod_fcgid to external under mod_fastcgi and it
> > appears to be leaking memory. There are 2 application backends and they
> > both suffered oom-killer events within six minutes of one another
> > yesterday and one of them again this morning after a cron job ran that
> > experienced some deep recursion calls.
> >
> > Both backends were running out of PARs when the first OOM events
> > occurred. To eliminate the PAR setup itself as a cause, I started one of
> > the backends by directly invoking myapp_fastcgi.pla and its memory
> > behavior is the same, so I'm pretty confident the invocation via PAR is
> > not a cause.
> >
> > I also checked my versions of CGI::FormBuilder to ensure I was up to
> > 3.501 and these all checked out.
> >
> > I have not yet determined if the conversion from mod_fcgid to
> > mod_fastcgi external is when the RAM usage started climbing - still
> > awaiting system reports - but, there haven't been an substantial changes
> > to the app since then that I would consider potential causes of a memory
> > leak. I'm guessing it's been there for a while, but it's only now
> > evident because the app instances were getting automatically recycled by
> > mod_fcgid and now they're not.
> >
> > I'm hoping someone here might have some light to shine on common FastCGI
> > memory leak issues.
> >
> > Is it generally an acceptable practice to just restart the external
> > fastcgi process periodically to free its memory?
> >
> > Any input is greatly appreciated.
> >



We wrote a plugin at work to deal with this at the handle_request
phase, that way nothing dies mid request.  You'll just have to bug
John Napiorkowski to release it :-)   I think its under the heat lamp
ready to go......



More information about the Catalyst mailing list