Perl FastCGI Issues

software development

#1

I’ve run into an issue that I can’t seem to track down. I had Catalyst set up and running with a “Hello World” script, and everything seemed to be in order for me to go on to something a little more in-depth. This was Friday evening, so I left it alone after getting that running. Last night (Saturday, 10/18) I decided to take a look at it, but now I just get a “500” error when I go to my site, and when I look at the error log there’s just a lot of this:

[Sun Oct 19 00:04:55 2008] [error] [client 69.224.68.31] FastCGI: comm with (dynamic) server "/home/war2d2/www/ms.zombiezone.net/test/script/dispatch.fcgi" aborted: (first read) idle timeout (60 sec) [Sun Oct 19 00:04:55 2008] [error] [client 69.224.68.31] FastCGI: incomplete headers (0 bytes) received from server "/home/war2d2/www/ms.zombiezone.net/test/script/dispatch.fcgi" (I have all my subdomains split up in a www directory)

I didn’t change anything, and my .htaccess and dispatch.fcgi seem, to me at least, to be in order. Here’s my .htaccess:

Options +ExecCGI
AddHandler fastcgi-script .fcgi

RewriteEngine On
RewriteRule ^(test/script/dispatch.fcgi/.)$ - [L]
RewriteRule ^(.
)$ test/script/dispatch.fcgi/$1 [PT,L]

And the dispatch.fcgi is just the Catalyst-generated test_fastcgi.pl renamed. Also, I did “include local::lib;” in both the dispatch.fcgi and test_cgi.pl, to have it point to my local CPAN install dir.

Have you run into any issues like this? I’ve tried blowing away the “test” directory and the .htaccess and redoing the setup, but get the same errors. When I do a ps -ef the only processes I see are ssh, ps, and bash.

I have an email in to DreamHost’s tech support, but if history is any indicator it’ll be a week before I hear back from them.

Any help you could give me would be great.


#2

Well, that doesn’t seem right. I can’t remember the last time anyone had week’s wait for a response. Even if the answer is only "I’m sorry, but we don’t provide support for your programming efforts, " it shouldn’t take a week to get a response.

Please PM me with one of your hosted domain names, or your WebID, or the primary email address associated with your account so that I can research your account history and see why you have not been getting responses in a timely manner!

Nobody should have to wait for a week! :open_mouth:

–rlparker
–DreamHost Tech Support


#3

Sorry if I made that sound like I was complaining–I wasn’t. I was just kind of frustrated at the time. I went back and looked and it was actually just 2 days between when I sent the message and got a reply.


#4

Some things to try…

Check that dispatch.fcgi and it’s dir are group writeable and are owned by the default group.

Restart with:
$ touch /home/war2d2/www/ms.zombiezone.net/test/script/dispatch.fcgi

Maybe play around with the Rewrite:
eg. RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Remember if there’s a script error this can cause the server to report a 500 after fcgi timeout, so debug scripts outside of fcgi.

Maximum Cash Discount on any plan with MAXCASH


#5

The script has always run fine from the cmd line (it’s just a machine-generated script from Catalyst, so I didn’t think there’d be a problem in the code).

All the scripts/dirs have the same owner/group id.

I tried the touch thing.

I was playing with the .htaccess rules, and didn’t seem to make a difference.

What I finally did was blow away the test directory and all the scripts, and just made a new “test” dir with a single FCGI script in it (pulled from the FCGI entry in the DH wiki). That worked when I first had it running, but then it died too. Tried all the tricks again, no dice, left it alone for a couple hours, and when I came back it runs fine.

So I have no idea what’s going on now. I’m going to try again with a Catalyst project, wish me luck.


#6

I forgot to say, I appreciate all the suggestions. Any help is great help. :slight_smile:


#7

Well, it seems to be working now. I didn’t wind up having to change the .htaccess any, so that seems like it wasn’t the problem. What I wound up doing is:

  1. first blew away the “test” app that I’d created with Catalyst
  2. recreated the directory structure of the Catalyst app (test/scripts) and put a new dispatch.fcgi in there:

[code]#!/usr/bin/perl -w

#-----------------------

CODE THAT RUNS ONCE

#-----------------------
$counter=0;

#---------------------------------

CODE THAT RUNS EVERY TIME

#---------------------------------

use lib qw[
/home/war2d2/perl5/lib/perl5
];

use FCGI;

while ( FCGI::accept() >= 0 )
{
$counter++;
print “Content-type:text/html\n\n”;
print “I have run $counter times.”;
}
[/code]3)That still was dodgy at best–it wouldn’t run, then it would run but the counter was at something like 15.
4) did a killall -9 dispatch.fcgi a few times, just to make sure any lingering processes were dead, and then did ps -ef to verify
5) Went to the /tmp directory, did

rm `ls -l | grep war2d2 | awk '{print $8}'`to remove all the tmp files that were in there (and there were a lot–like 30 or so).
6) Retried the url, this time the counter started at ‘1’ and progressed normally
7) did the killall and ps thing again, then blew away the directory structure I’d created
8) created a new “test” application with catalyst.pl
9) did chmod +x on the contents of the test/script directory
10)in the test/script directory, created a dispatch.fcgi with the following code:

[code]#!/usr/bin/perl -w

use lib qw[
/home/war2d2/perl5/lib/perl5
];

do ‘test_fastcgi.pl’;
[/code]

And that seems to be that. Not sure which part of it fixed it, but it seems to be working now. /crosses fingers

At least, I’m getting the Catalyst welcome screen. We’ll see if that continues to be happy happy joy joy as I continue work on the app…