segmentation fault with Ruby 1.8.6-p111 on 64bit Linux

I apologize to anyone who just caught me cross-posting, it's urgent.

I'm having issues getting a Rails app to run on a new 64bit Linux box.
The app has been working fine for some time on an older 32bit machine
that's being decommissioned soon.

Here's the error:

/usr/local/lib/ruby/1.8/pstore.rb:354: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [x86_64-linux]

It occurs on the first request to the Rails app, every time.

The Linux distro is RedHat 5. It came with Ruby 1.8.5. I compiled a
new 1.8.6-p111, reinstalled all the gems, but I'm still getting the
same error.

Anyone know how to fix this? Ruby 1.9?

Thanks,

Not an expert on this at al, but I have fought with other things
crashing over the years

Can you start the Rails console? Can you run Ruby on a simple script
(create an empty file and just try running it)?

If you can, try and find out what command is giving you the error and
look at the 'C' code surrounding it. Maybe even start up a gdb session
and do some digging.

The other thing it *may* be is that you are linking to a 32-bit shared
library somewhere. I don't know enough about your environment to
comment but try looking on groups for segmentation faults on your
distro, not just Ruby, it might point you in the right direction.

HTH

I finally found a work-around last night. The problem turned out be
my least favourite chunk of code on the planet, the ruby-oci8 driver.

I was doing a bunch of collection inserts at once, stuff that I was
previously letting build up in a session because I didn't want to
insert it until after I had it's connecting data inserted. I reworked
my code to do the inserts one at a time and that seems to work with no
segfaults:

The bad code:

@foo.bars = session[:bars]

became something like

session[:bars].each do |b|
  bar = Bar.find(b)
  @foo.bars << bar
end