Dispatch.cgi error affecting specific browsers

I have a rails app that is accessed through Apache 2 (just using cgi
now; will add fastcgi later when everything is working).

The app works fine with some os/browser combos at my work site:
windows/IE
Mac/safari
Mac/firefox
Linux/firefox

But it fails on windows/firefox and my colleague’s (at a different site)
mac/safari (we are running the same os version and version of safari)

The actual error reported in the browser is:
Application error
Rails application failed to start properly

And in the apache error log:
Premature end of script headers: dispatch.cgi

I have read numerous postings about this error and have made sure that:
-permissions on my app are set correctly
-hashbang line is correct in dispatch.cgi
-line endings are correct in dispatch.cgi

What seems to be different than most other reports of this problem is
the fact that it works on some browsers but not others. Any ideas?
Thanks

Hi Dan ~

What OS are you serving from? I had many issues with Windows hosting and
Apache.

I would highly recommend the switch to FastCGI. I personally had
numerous
issues with Apache+FastCGI, and jumped ship for Light. Never been
happier.

~ Ben

Ben R. wrote:

Hi Dan ~

What OS are you serving from? I had many issues with Windows hosting and
Apache.

Serving from Fedora Core 4 Linux.

I would highly recommend the switch to FastCGI. I personally had
numerous
issues with Apache+FastCGI, and jumped ship for Light. Never been
happier.

I’ve had trouble getting lighttpd to work, also we have some limitations
which may dicate using apache. I think fastcgi is a good idea, but I
also think it’s a good idea to make sure everything works using cgi
first. I may be wrong.

Still having the problem…hope this rings a bell with someone…

Craig W. wrote:

Still having the problem…hope this rings a bell with someone…


try (for S & G)

service httpd stop

rm /tmp/ruby.sess*
rm -fr /tmp/fcgi*

service httpd start

(just to make sure that all session data has been cleared out before you
start httpd)

Craig

That worked!

Thanks. BTW, what do you mean by S & G?

Also, what are the best practices for removing the session files? The
agile book suggests a cron script to remove all scripts over 6 hours
old.

Is it a good idea to remove all session files when restarting the web
server?

Do you know what the mechanics of this problem are? In other words, how
exactly does a session file cause a “premature end of script headers”
error? Just trying to understand and help prevent the problem in future.

Thanks again

On Wed, 2006-02-15 at 22:27 +0100, Dan T. wrote:

service httpd start

(just to make sure that all session data has been cleared out before you
start httpd)

Craig

That worked!

Thanks. BTW, what do you mean by S & G?


sh*ts and grins - obtuse expression that stuck with me after I first
heard it

Also, what are the best practices for removing the session files? The
agile book suggests a cron script to remove all scripts over 6 hours
old.


makes sense but I took that out to 8 hours (just in case)

Is it a good idea to remove all session files when restarting the web
server?


I think experience is gonna teach me some of this…I have less than
little

Do you know what the mechanics of this problem are? In other words, how
exactly does a session file cause a “premature end of script headers”
error? Just trying to understand and help prevent the problem in future.


I doubt I can give you a very good explanation but by wag is simply that
you have a browser open that is attached to a session and the server
methodology has changed but the browser is still attached to the session
and so it remains…by deleting the session, it makes the server create
a new session with the new methodology/parameters.

Craig

On Wed, 2006-02-15 at 21:05 +0100, Dan T. wrote:

numerous
issues with Apache+FastCGI, and jumped ship for Light. Never been
happier.

I’ve had trouble getting lighttpd to work, also we have some limitations
which may dicate using apache. I think fastcgi is a good idea, but I
also think it’s a good idea to make sure everything works using cgi
first. I may be wrong.

Still having the problem…hope this rings a bell with someone…


try (for S & G)

service httpd stop

rm /tmp/ruby.sess*
rm -fr /tmp/fcgi*

service httpd start

(just to make sure that all session data has been cleared out before you
start httpd)

Craig