FCGI hanging w/ LightTPD in about 24-48 hours


#1

I started an earlier thread about this … Someone suggested a different
version of LightTPD, since the version I was using had some known issues
with FCGI. Well, we’ve upgraded to LightTPD 1.4.11 and the problem is
still happening.

We have Rails running under fcgi (one process) under LightTPD. This, in
turn, is proxied to by Apache. This is on a test IP, so only a few
people should be looking at it at any given time.

Initially, this works great – everything is nice and speedy, no errors.
Somewhere between 24-48 hours later, the fcgi process hangs. It shows up
in ps, but is completely unresponsive. If I kill it (with -9), things
work fine again – LightTPD spawns a new fcgi process to handle it.

I’ve looked through the logs and I haven’t seen anything. I’ve checked
the /var/log/lighttpd/lighttpd.error.log, and the log files in the Rails
app, but nothing indicates the problem. Of course, it would help if I
knew what to look for … the entries I do see seem to be things that
have appeared at times when it was running okay, though.

This is the fcgi section of lighttpd.conf:

1: fastcgi.server = ( “.fcgi” =>
2: (“rails” =>
3: ( “socket” => “/tmp/foo-fcgi.socket”,
4: “bin-path” =>
“/usr/www/sites/foo/public/dispatch.fcgi”,
5: “bin-environment” => (“RAILS_ENV” =>
“development”),
6: “min-procs” => 1,
7: “max-procs” => 1
8: )
9: )
10: )

Some questions about this config:

  1. Reading through the LightTPD docs, I came across idle-timeout
    parameter. I haven’t seen this used in other examples of lighttpd.conf
    I’ve seen, but it looks like it might be helpful in this case. Or it
    might cover up the symptoms without addressing the real problem. What do
    people think of this? I was thinking of setting “idle-timeout” => 60.

  2. Someone mentioned that maybe the file referenced in line 3 is being
    deleted by a cron job. I suppose this is possible – I’m looking into
    it. What is that file, exactly? Is it a named pipe used to communicate
    between Rails and LightTPD? If this file were deleted by a cron job,
    would this explain the hanging process? Also, if I want to put this file
    somewhere other than /tmp, can I just change the value here or does it
    need to change in the Rails code somewhere, too?

  3. Probably doesn’t hurt anything, but I’m not really sure what line 2
    is really needed for. This seems to be a place to put an additional
    prefix or file suffix. Does this do something else?

  4. When is Mongrel going to be ready to replace fcgi? :wink:

I’ll obviously experiment with some of the above, but I wanted to hear
about others thoughts and opinions.

Thanks!

Jen