1

I often get a "premature end of script headers" error in my apache log which results to an internal 500 error. I understand what the error message means - that my application did not give the browser the headers it needs (and maybe nothing at all), but the odd thing is that this does not happen all the time. It actually usually happens the first few times I go to my website after a deploy. Could this be a memory issue? Does anyone know how to trouble shoot this? My apache log isn't really telling me anything.

I am running a ruby site using the rails framework on ubuntu hardy.

thank you!

2 Answers 2

1

If this is happening right after a deploy, what it probably means is that the Ruby process is restarting and isn't ready to serve pages yet. Apache will only give it a certain amount of time to serve each page, and then it will time it out and serve a 500. Once the Ruby process 'warms up' then everything is fine again.

Your Apache access logs should tell you how long the failed requests took. My guess is that they will be the same as an Apache-configured timeout; for example: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidconnecttimeout

0

What script are you running, Perl?

You can try enabling warnings and using Carp to trap the errors like this:

#!/usr/bin/perl -w
use strict;
use CGI::Carp qw/fatalsToBrowser/; 
1
  • actually ruby, i updated the question
    – Tony
    Nov 12, 2009 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .