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
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” =>
5: “bin-environment” => (“RAILS_ENV” =>
6: “min-procs” => 1,
7: “max-procs” => 1
Some questions about this config:
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.
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?
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?
When is Mongrel going to be ready to replace fcgi?
I’ll obviously experiment with some of the above, but I wanted to hear
about others thoughts and opinions.