Monday, February 4, 2008

FastCGI: incomplete headers (0 bytes) received from server

Today I nearly spent my whole day in resolving a small problem which took hardly 30 seconds to resolve. The issue was quite simple. While upgrading one of the rails application on my local machine I suddenly started getting this error in my apache logs.
[Mon Feb 04 16:48:50 2008] [error] [client 127.0.0.1] FastCGI: comm with (dynamic) server "/home/chetan/www/myrailsproject/public/dispatch.fcgi" aborted: (first read) idle timeout (30 sec) [Mon Feb 04 16:48:50 2008] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/home/chetan/www/myrailsproject/public/dispatch.fcgi"
With this I put my seat belts on and started googling. There were many users who faced the similar problem while upgrading Rails. But each one was telling a different solution in his anecdote. I tried each of them but nothing worked for me. May be bad luck was not good today. I continued my hunt and kept looking for other solutions. Ultimately my prayers were accepted and I got the solution in one of the message boards. The problem was in the shebang line of dispatch.fcgi file. It was set to #!/usr/local/bin/ruby in the updated version, whereas in my machine ruby executable was located at /usr/bin/ruby. I fixed this and everything returned back to normal. I wish I had got this post in the very beginning so that my whole day would save. :)

No comments: