Project

General

Profile

FastCGI processes die after a few seconds

Added by Jesco Freund over 15 years ago

Hi,

I've got Redmine 0.7.3 on a Gentoo box using Rails 2.0.2 and sqlite3 as backend. Using webrick, everythin works fine. However, I'd like to use lighttpd + FastCGI to run this Redmine installation.

This is were the problems start. I've installed all dependencies (ruby-fcgi etc.) on my box, and lighttpd actually starts and spawns 5 FastCGI processes. However, some seconds later, all 5 processes are defunct. Unfortunately, they do not write anything to the production logfile. As they're started by lighttpd, I cannot even find out about the real exit status (lighty's log says 1, but I guess this is not the full truth as the process is already inactive when lighty tries to access it).

This is how it looks like (using ps auxf):

lighttpd  6459  0.0  0.0   4788   900 ?        S    15:35   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  6461 72.0  0.7  24872 21820 ?        R    15:35   0:00  \_ /usr/bin/ruby /var/www/localhost/htdocs/dispatch.fcgi
lighttpd  6464 54.0  0.5  21356 18332 ?        R    15:35   0:00  \_ /usr/bin/ruby /var/www/localhost/htdocs/dispatch.fcgi
lighttpd  6465 50.0  0.5  20568 17596 ?        R    15:35   0:00  \_ /usr/bin/ruby /var/www/localhost/htdocs/dispatch.fcgi
lighttpd  6466 40.0  0.4  15852 12772 ?        R    15:35   0:00  \_ /usr/bin/ruby /var/www/localhost/htdocs/dispatch.fcgi
lighttpd  6467 34.0  0.4  14260 12468 ?        R    15:35   0:00  \_ /usr/bin/ruby /var/www/localhost/htdocs/dispatch.fcgi

3 seconds later:

lighttpd  6459  0.0  0.0   4788   916 ?        S    15:35   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  6461  2.7  0.0      0     0 ?        Z    15:35   0:00  \_ [dispatch.fcgi] <defunct>
lighttpd  6464  2.8  0.0      0     0 ?        Z    15:35   0:00  \_ [dispatch.fcgi] <defunct>
lighttpd  6465  2.7  0.0      0     0 ?        Z    15:35   0:00  \_ [dispatch.fcgi] <defunct>
lighttpd  6466  2.8  0.0      0     0 ?        Z    15:35   0:00  \_ [dispatch.fcgi] <defunct>
lighttpd  6467  2.7  0.0      0     0 ?        Z    15:35   0:00  \_ [dispatch.fcgi] <defunct>

And here's the relevant extract from my lighttpd configuration file:

fastcgi.server = (
        ".fcgi" => (
                "redmine" => (
                        "min-procs" => 1,
                        "max-procs" => 5,
                        "socket" => "/var/run/lighttpd/redmine.sock",
                        "bin-path" => var.basedir + "/htdocs/dispatch.fcgi",
                        "bin-environment" => (
                                "RAILS_ENV" => "production" 
                        )
                )
        )
)

server.error-handler-404 = "/dispatch.fcgi" 

Regarding my Rails environment, I installed everything from Gentoo portage ebuilds. This is what gem lists for my box:

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
fcgi (0.8.7)
rails (2.0.2)
rake (0.8.3)

Btw. the about script dies with the following message:

/var/www/redmine-0.7.3/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant Rails::Info (NameError)
        from /var/www/redmine-0.7.3/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:453:in `const_missing'
        from /var/www/redmine-0.7.3/vendor/rails/railties/lib/commands/about.rb:2
        from script/about:3:in `require'
        from script/about:3

Has anyone a good idea what could be behind this? Or at least a clue how I could debug this weird FastCGI behaviour?

Regards, Jesco


Replies (1)

RE: FastCGI processes die after a few seconds - Added by huayang huang almost 14 years ago

可能没安装fcgi
参考
http://tech.techweb.com.cn/thread-419275-1-1.html
安装 Ruby 的 FCGI 支持
由于ruby的fcgi支持库需要在编译的时候联接FCGI的系统库,因此我们需要先安装FCGI库,下载FCGI源代码发行包:

http://www.fastcgi.com/dist/

tar xzvf fcgi-2.4.0.tar.gz

cd fcgi-2.4.0

./configure --prefix=/usr/local/fcgi

make && make install

同样,将fcgi安装在自己指定的目录下,而不是默认的/usr/local,避免多个软件混在一起。

然后就可以安装ruby的fcgi支持库了,下载ruby-fcgi-0.8.7.tar.gz

http://rubyforge.org/projects/fcgi/

tar xzvf ruby-fcgi-0.8.7.tar.gz

ruby-fcgi-0.8.7

ruby install.rb config -- --with-fcgi-include=/usr/local/fcgi/include --with-fcgi-lib=/usr/local/fcgi/lib

ruby install.rb setup

ruby install.rb install

    (1-1/1)