Dispatch.fcgi is hanging indefinitely

I am getting a Rails application failed to start properly.

When I use webrick it is alright. The problem appears to come from the
fcgi part.

when I run ./dispatch.fcgi or ruby dispatch.fcgi the it hangs
indefintely.

This is the error I get in the main server log

[notice] mod_fcgid: process /home/pydev/rubystack/html/rdm/
dispatch.fcgi(10045) exit(communication error), terminated by calling
exit(), return code: 1

This is the error I get in the domain’s log

[Sun Feb 28 01:57:51 2010] [warn] (104)Connection reset by peer:
mod_fcgid: read data from fastcgi server error.
[Sun Feb 28 01:57:51 2010] [error] [client 192.168.1.20] Premature end
of script headers: dispatch.fcgi

Any ideas?

Old post… Anyway, I guess you get this problem from running
production but not on development. It is that the fcgi process gets
killed before it finishes the process. This could be from huge
database manipulation. You can try to find it by comment a certain
part of your code and see if it is still running.