Running Rails on 64-Bit Linux - Segmentation Fault

Just wanted to post a warning for everyone out there.

We just migrated our application to a 64-Bit Red Hat Enterprise 5
Server, and when we migrated we dutifully installed the latest ruby
patch p230 for Ruby 1.8.6. As soon as we got our web server running
(Litespeed), our pages failed for what seemed like no reason.

At first, my only inkling on the rails side was a failure on the
"protect_from_forgery?" function on a remote form, but then I started
getting 503 errors, which shouldn't happen. Worse yet, it happened
intermittently, so repeating the problem was almost impossible.

When I dug into the server's error log, I started seeing a
segmentation fault [bug] warning. It's not something we've ever
experienced with our site or with Ruby.

Low and behold, after much hand wringing and searching the depths of
every ruby, rails, and linux groups, it turns out that ruby-1.8.6-p230
causes the segmentation fault sometimes when the ActiveSupport gem is
called. To fix the problem, we downgraded our Ruby version to what we
originally developed on ruby-1.8.6-p111. All is well. no more wierd
errors or segmentation faults.

I know we searched far and wide for an answer to this issue, so I
thought it would be a good idea to post how we fixed it.

On another note: when installing ruby and rails on the Red Hat
Enterprise 5, make sure you have the zLib-devel and openssl-devel
installed before you install ruby, or your ruby installation and
subsequent rails installation can get almost hopelessly borked.
Sometimes zLib and openssl is there, but zLib-devel and openssl-devel
may not be. Use Yum to install them...it's just easier. the ROR wiki
says to use 'up2date zlib_devel', but up2date is not valid on Red Hat
Enterprise 5.

That's it. I hope we saved someone a few hours.
-Chris

Just wanted to post a warning for everyone out there.

We just migrated our application to a 64-Bit Red Hat Enterprise 5
Server, and when we migrated we dutifully installed the latest ruby
patch p230 for Ruby 1.8.6. As soon as we got our web server running
(Litespeed), our pages failed for what seemed like no reason.

At first, my only inkling on the rails side was a failure on the
"protect_from_forgery?" function on a remote form, but then I started
getting 503 errors, which shouldn't happen. Worse yet, it happened
intermittently, so repeating the problem was almost impossible.

When I dug into the server's error log, I started seeing a
segmentation fault [bug] warning. It's not something we've ever
experienced with our site or with Ruby.

Low and behold, after much hand wringing and searching the depths of
every ruby, rails, and linux groups, it turns out that ruby-1.8.6-p230
causes the segmentation fault sometimes when the ActiveSupport gem is
called. To fix the problem, we downgraded our Ruby version to what we
originally developed on ruby-1.8.6-p111. All is well. no more wierd
errors or segmentation faults.

I know we searched far and wide for an answer to this issue, so I
thought it would be a good idea to post how we fixed it.

On another note: when installing ruby and rails on the Red Hat
Enterprise 5, make sure you have the zLib-devel and openssl-devel
installed before you install ruby, or your ruby installation and
subsequent rails installation can get almost hopelessly borked.
Sometimes zLib and openssl is there, but zLib-devel and openssl-devel
may not be. Use Yum to install them...it's just easier. the ROR wiki
says to use 'up2date zlib_devel', but up2date is not valid on Red Hat
Enterprise 5.

That's it. I hope we saved someone a few hours.

I didn't use the rpm or yum packages because they stopped at
1.8.5.el5_2.3, at least the packages I could find.
So I compiled from source after wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p111.tar.gz
and then you followed the steps at http://www.redhatmagazine.com/2006/11/16/ruby-on-rails-on-red-hat/.

It's actually good to know that the 230-4 patch works as expected. I
couldn't find that written up anywhere...that would have saved me some
time. Plus, I was trying to get a 64 bit build, which you will get
when you compile from source. Installing with the rpm package only
gives you i386. Now, I don't know everything, obviously, We've only
just graduated to our shiny new 64-bit server and had been working on
a 32-bit during all of our dev work. Take it with a grain of salt.

-Chris

I didn't use the rpm or yum packages because they stopped at
1.8.5.el5_2.3, at least the packages I could find.
So I compiled from source after wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p111.tar.gz
and then you followed the steps at http://www.redhatmagazine.com/2006/11/16/ruby-on-rails-on-red-hat/.

It's actually good to know that the 230-4 patch works as expected. I
couldn't find that written up anywhere...that would have saved me some
time. Plus, I was trying to get a 64 bit build, which you will get
when you compile from source. Installing with the rpm package only
gives you i386. Now, I don't know everything, obviously, We've only
just graduated to our shiny new 64-bit server and had been working on
a 32-bit during all of our dev work. Take it with a grain of salt.

Thanks Craig. These are all good things to know.

I knew the articles were a couple of years old. I guess this is one of
the issues you run into when working with open source, there is so
much information of so varying quality, that you really need to pick
your resources carefully. Sometimes articles are new and wrong...and
sometimes they are old and right. It sucks when you're really just
getting into the Linux world because the sheer quantity of information
is daunting.

From the coddled world of IIS and .NET to getting our Linux running
Ruby has been painful at times...and I really appreciate the advice
and clarification.

Thankfully, other than not using RPM, things are running smoothly
now. I'll have to rectify the RPM issue for maintenance's sake.

Thanks again,
-Chris

Thanks Craig. These are all good things to know.

I knew the articles were a couple of years old. I guess this is one of
the issues you run into when working with open source, there is so
much information of so varying quality, that you really need to pick
your resources carefully. Sometimes articles are new and wrong...and
sometimes they are old and right. It sucks when you're really just
getting into the Linux world because the sheer quantity of information
is daunting.

From the coddled world of IIS and .NET to getting our Linux running
Ruby has been painful at times...and I really appreciate the advice
and clarification.

Thankfully, other than not using RPM, things are running smoothly
now. I'll have to rectify the RPM issue for maintenance's sake.

Thanks again,