[Catalyst] Memory leak under FastCGI?

Matt Pitts mpitts at a3its.com
Mon Apr 7 15:52:54 BST 2008


> -----Original Message-----
> From: Matt S Trout [mailto:dbix-class at trout.me.uk]
> Sent: Sunday, April 06, 2008 1:18 PM
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] Memory leak under FastCGI?
> 
> On Wed, Mar 19, 2008 at 03:32:12PM -0400, Matt Pitts wrote:
> > 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.
> 
> Right, which is why I'm confused by your mentioning 'under FastCGI'.
> 
> The problem is almost certainly that your application has a memory
leak
> in
> it, not the engine side of things - you should try replaying a known
> set of
> requests against the application and use things like Devel::Leak to
> determine if you're leaking SVs.
> 
> > Is it generally an acceptable practice to just restart the external
> > fastcgi process periodically to free its memory?
> 
> Yep. Other than really gross leaks it's often not worth the developer
> time
> involved to track them down.

Thanks for the feedback. I got a pointer to:

http://www.catalystframework.org/calendar/2007/18

And after looking that over I started feeling like copy-on-write was
more the cause than leaking memory. It may still be leaking, but it is
so gradual that it's hard to know without a detailed investigation.

As of now, I'm trying to hack up a better ProcManager based on
FCGI::Engine::ProcManager that actually recycles its children using
options like MaxRequestPerChild. Hopefully, I'll be able to get it done
and cleaned up enough to release.

[OT] Can anyone recommend a good IPC message queue? I was working with
IPC::PubSub, but then started getting weird errors out of DBM::Deep. I
want something lite that doesn't require a completely separate process
and keeps me from having to deal with sockets.

v/r

-matt pitts



More information about the Catalyst mailing list