FastCGI with Ruby (and Perl) failing

Dennis Sutch <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
We're attempting to setup FastCGI on a production server. We've been 
successful in setting it up on our development server, but the production 
server returns errors.

When we point a browser to the URL, a 500 error is returned.

The Apache error logs return multiple duplicate entries containing HTML:

[Wed Apr 27 11:07:26 2005] [warn] FastCGI: (dynamic) server 
"/var/www/ruby_fastcgi_test/index.fcgi" started (pid 12935)
Content-Type: text/html
Content-Length: 119

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><BODY><H1>Hello 
World!</H1><P>Counter: 1</P></BODY></HTML>[Wed Apr 27 11:07:26 2005] [warn] 
FastCGI: (dynamic) server "/var/www/ruby_fastcgi_test/index.fcgi" (pid 
12935) terminated by calling exit with status '0'
[Wed Apr 27 11:07:31 2005] [warn] FastCGI: (dynamic) server 
"/var/www/ruby_fastcgi_test/index.fcgi" restarted (pid 12936)
Content-Type: text/html
Content-Length: 119

The Apache error logs also return multiple lines complaining about the 
script failing to remain running:

[Wed Apr 27 11:07:41 2005] [warn] FastCGI: (dynamic) server 
"/var/www/ruby_fastcgi_test/index.fcgi" has failed to remain running for 30 
seconds given 3 attempts, its restart interval has been backed off to 600 
seconds

Similar results occur when testing against Perl with FCGI.

Here's our Ruby test script:

#!/usr/local/bin/ruby
#require 'fcgi'
require 'rubygems'
require_gem 'fcgi'
counter = 0
FCGI.each_cgi('html3') do |cgi|
counter += 1
cgi.out {
cgi.html {
cgi.body {
cgi.h1 { "Hello World!" } +
cgi.p { "Counter: #{counter}" }
}
}
}
end 

httpd.conf contains a virtual host with:

DocumentRoot "/var/www/ruby_fastcgi_test" 
DirectoryIndex index.fcgi 
<Directory "/var/www/ruby_fastcgi_test"> 
Options ExecCGI 
AllowOverride None 
Order allow,deny 
Allow from all 
</Directory> 

fastcgi.conf contains:

LoadModule fastcgi_module modules/mod_fastcgi.so 
<IfModule mod_fastcgi.c> 
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>

The production server setup:

Red Hat EL 4.0
MySQL 4.1.10a-1
Apache 2.0.52-9
Ruby 1.8.2 (compiled manually, older redhat rpm version removed)
Ruby Gems 0.8.10
fcgi (rubygem) 0.8.5
fcgi libraries/source 2.4.0
mod_fastcgi 2.4.2

The development server is a bit older. The only differences between the 
servers appears to be:

RH EL 3 (Update 4)
apache 2.0.46-44

We're not sure what else to do to troubleshoot this. Does anyone have any 
suggestions?

- Dennis

-- 
"Thanks to the crew of rocketscientists.ca for the gmail invitation!"
http://www.rocketscientists.ca/

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.