Fcgid -> errors

Hi,

I’m trying to get rails running on Debian stable with Apache 2,
mod_fcgid, Rails 1.0. The application works fine with webrick (*).

Let’s start here:

@eugene [/var/www/ls2/linuxsi/public] $ ./dispatch.fcgi
Status: 500 Internal Server Error

Seems to result in the following in the log files:

[12/Feb/2006:12:18:40 :: 4105] starting
[12/Feb/2006:12:18:40 :: 4105] terminated gracefully

so far, so good, I guess, although the ‘500’ isn’t very encouraging.

Let’s try it for real:

Application error
Rails application failed to start properly

Uh, ok… that’s not very informative, so let’s go look at the log
files:

development.log seems to indicate that things are ok from rails’ point
of view:

Processing StoresController#search (for 10.0.0.60 at 2006-02-12
12:24:02) [GET]
Parameters: {“action”=>“search”, “controller”=>“stores”}
Province Load (0.009293) SELECT * FROM provinces
Rendering within layouts/stores
Rendering stores/search
SQL (0.021030) SELECT a.attname, format_type(a.atttypid,
a.atttypmod), d.adsrc, a.attnotnullince Load (0.009293)ESC[0m
ESC[0;1mSELECT * FROM provinces
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = ‘provinces’::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

Completed in 0.17092 (5 reqs/sec) | Rendering: 0.06057 (35%) | DB:
0.03032 (17%) | 200 OK [http://linuxsi/stores/search]

fastcgi seems less healthy though:

Logfile created on Sun Feb 12 12:24:01 CET 2006 by logger.rb/1.5.2.4

[12/Feb/2006:12:24:01 :: 4133] starting
[12/Feb/2006:12:24:06 :: 4133] asked to terminate immediately
[12/Feb/2006:12:24:06 :: 4133] terminated by explicit exit

Let’s back up a minute and make sure the web server is ok… yeah, it
serves up the rails app’s public/ files just fine.

What’s apache’s log file have to say about the fcgid error?

[Sun Feb 12 12:26:41 2006] [notice] mod_fcgid: server
/var/www/ls2/linuxsi/public/dispatch.fcgi(4162) started
[Sun Feb 12 12:26:46 2006] [error] [client 10.0.0.60] Premature end of
script headers: dispatch.fcgi, referer: http://linuxsi:13000/
[Sun Feb 12 12:26:53 2006] [notice] mod_fcgid: process
/var/www/ls2/linuxsi/public/dispatch.fcgi(4162) exit(communication
error), get stop signal 15

That doesn’t look good:-/

Here’s my .htaccess file:

AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

At this point… I’m stumped.

Thanks,

David N. Welton

Linux, Open Source Consulting

(*) Well, aside from this problem:

http://www.ruby-forum.com/topic/54290#new

David N. Welton wrote:

At this point… I’m stumped.

Responding to myself so that others can find the solution, which was a
bit tricky to track down. I strace’ed the whole process via apache -X,
and noticed that it killed the child when the child appeared to still be
loading things. Since this is an older, slower computer, I added this
to the configuration, and now things work:

IPCCommTimeout  20
IPCConnectTimeout 20

Ciao,

David N. Welton

Linux, Open Source Consulting