I have both ruby-1.8.7-p330 and ruby-1.9.2-p136 installed on my CentOS
server. I'm using Passenger (3.0.2) and Apache 2.2.3.
When using ruby-1.8.7, my app seems to be working fine.
When I change to ruby-1.9.2, GET requests seem to be fine, but POSTs
produce the following Apache error:
(104)Connection reset by peer: ap_content_length_filter:
apr_bucket_read() failed
And the following is in my production log:
Started POST "/login/verify_login" for etc...
TypeError (can't convert nil into Integer):
From Googling, it looks like Apache is expecting Rails to handle the
request differently. I've seen this quote: "This works as designed. It
is the task of the cgi script to swallow the whole request body prior
to sending a response, whether it uses it for some purpose or not."
Ok, so what do I change in Rails to make that happen?
Downgrading Ruby 1.9.2 to 1.8.7 fixed the issue for me.
I tried creating a new CRUD via "rails generate scaffold test
name:string" and even creating a new object there failed.
Instead of determining root cause, and since I don't require 1.9.2, I
downgraded.
Since I am using RVM, I am able to downgrade to 1.8.7 on both my dev
machine and server in only 10 minutes. I had to change some gems
(e.g. ruby-debug19 to ruby-debug) in my Gemfile, then run "bundle
install" on my dev machine, check in the new gems into SVN, then "cap
deploy" to the server.
On the server, with RVM now set to 1.8.7 ( rvm install ruby-1.8.7; rvm
use --default ruby-1.8.7; rvm use default ) I installed the passenger
gem ( gem install passenger ) and recompiled the apache module
( passenger-install-apache2-module ) and then had to reset my
httpd.conf file with the new setting for passenger, as specified by
the output to the passenger-install-apache2-module.
I was about to try a blank test program, too. I haven't had time to
let the server be down at the moment, so I backed down to 1.8.7 too. I
understand that 1.9.2 has much better performance, though, so I'd
really like to get it to work.
Can someone who is successfully using CentOS/Apache/Passenger/Ruby
1.9.2/Rails 3.0.3 please post the versions of CentOS, Apache, and
Passenger you are using? I can't think of any other variable that
could be relevant, can you?
Thanks for the tip. I do have attachment_fu in my app (although I plan
to switch to Paperclip). I removed it completely as a test (deleted
all the files under vendor/attachment_fu), then restarted httpd, but
it didn't seem to help.