[Catalyst] FCGI automatic restart / memory leaks

Bernhard Graf catalyst2 at augensalat.de
Thu Aug 16 10:18:32 GMT 2007

On Thursday 16 August 2007 10:40, Tobias Kremer wrote:
> I just deployed our quite large Catalyst app and I'm seeing a
> constant increase in memory usage. Here's a current snapshop from
> top:

> We're using lighttpd and handle the starting of the FCGI server
> manually. Is there a way to have the FCGI children restart once in a
> while without having to restart the whole FCGI process manager (and
> bringing down the application for a few seconds)? Something like
> Apache's MaxRequestsPerChild directive would be cool.

I use daemontools similar to
http://www.catalystframework.org/calendar/2006/4 .

My run file looks like this:


cd /srv/www/vhosts/myapp

exec 2>&1 \
    setuidgid myappuser \
    softlimit -m 150000000 \
        script/myapp_fastcgi.pl -e -l /var/tmp/myapp/fastcgi.socket -n 10

Sets uid and gid to "myappuser ", Spawns 10 processes and listens on the
specified UNIX socket. If a process gets too big, it gets terminated and
replaced by a fresh one (softlimit is part of daemontools, but you could
use ulimit instead).

> Then it's time to go memory leak hunting :(

I don't care much since softlimit restarts the FCGI processes (under
normal conditions approx. every 12 hours).

BTW - here are the manpages for daemontools

Bernhard Graf

More information about the Catalyst mailing list