Segfault after page view

I realize this is slightly off-topic, but I’m stumped and I hope someone
else has had the same problem.

When running a rails app using webrick (script/server), I can load any
given page which involves a controller once, and any subsequent page
loads trigger a “Segmentation fault” without any other info.

This problem is very new, and has only started occurring since I last
updated my Gentoo linux system, so I assume it’s something to do with
Gentoo, but the only place I see a problem is with rails. In fact, it’s
only with my personal projects; instiki works just fine (as do basic,
html-loading webrick instances).

Go ahead and ask me any questions you think might be useful. I have all
kinds of details. I wouldn’t ask this here if I had somewhere else to
turn.

Thank you.

-Payton

Try running memtest86. The first thing I think when I start seeing
segfaults is bad RAM.

If that doesn’t show anything, I’d try recompiling ruby and reinstalling
rails freshly.

Tony

Memory appears to be ok… I did try recompiling ruby (1.8.4-r1) and
reinstalling the rails gem (as well as activerecord, actionpack,
actionmailer, actionwebservice, activesupport). No effect.

What’s odd is that everything works fine on the first page request, so
if I keep stopping and restarting webrick, then I can use the
application. If anyone’s interested in an strace, I have that too. Any
other ideas?

-Payton

As an interesting side note, it’s not just webrick, mongrel also
segfaults in precisely the same way. The bizarreness of this problem is
painful.

-Payton

On Feb 21, 2006, at 1:33 PM, Payton S. wrote:

When running a rails app using webrick (script/server), I can load
somewhere else to turn.
Thank you.
-Payton

I have a similar problem that only seems to effect Hieraki but not
any of the rails apps that I am writing. During a callback from
doing an insert into the user table, the ruby interpreter seg-
faults. It is in the middle of the Activerecord base class. It is
trying to invoke create_or_update (if I remember correctly) and it
appears to try to start executing code in the middle of the method,
not the beginning. At this point, it is in ruby code but it has been
calling into the C routines that interface into MySQL. I am running
Ruby 1.8.4, Rails 1.0.0, MySQL 4.1.18, and the MySQL 2.7 ruby
interface routines. All this is running on FreeBSD 5.4. I have tried
compiling everything from scratch. I have tried running Hieraki as a
cgi, fast-cgi and scgi process using Apache 2.0.55. I have also
tried running it using Webrick. I have tried running it on another
machine, using the same OS and software versions. I have also tried
running it with PostgreSQL 8.1.2 using the C interface version
0.7.1. It always seems to seg-fault in the same place.

I haven’t had any more time to pursue the problem in the last few
weeks and unfortunately, I won’t have time to look into it any
further for a few weeks.

Kim

Kim S. - principal, Shrier and Deihl - mailto:[email protected]
Remote Unix Network Admin, Security, Internet Software Development
Tinker Internet Services - Superior FreeBSD-based Web Hosting
http://www.tinker.com/

The gentoo install is 2005.1 and I installed it about 4 months ago.
There have never been any problems with ruby until this last emerge.
The architecture is ~x86 and I doubt there’s anything wrong with my
make.conf settings, as those haven’t changed.

At the bottom of this message is a list of all the packages I emerged
when this became a problem. I use ruby and rubygems from portage, but I
use rails and associated packages from gems. I’m using ruby-1.8.4-r1
and rubygems-0.8.11. Neither are masked. (I have also tried
rubygems-0.8.11-r3).

I was loading ruby-mysql, but I have since disabled activerecord, and
there been no change in the problem.

I have searched the Gentoo bugzilla for a ruby or rails problem like
mine, but have not found any help. I’m submitting my problem there too
in hopes of an answer.

Packages emerged:
sys-apps/sed-4.1.4-r1
sys-apps/man-pages-2.22
app-crypt/hashalot-0.3-r2
virtual/perl-Test-Simple-0.62
app-misc/pax-utils-0.1.9
sys-apps/baselayout-1.11.14-r5
dev-libs/openssl-0.9.7i
virtual/perl-Storable-2.15
app-crypt/gnupg-1.4.2.1
media-libs/imlib2-1.2.1.009
virtual/perl-libnet-1.19
virtual/perl-Digest-MD5-2.33
virtual/perl-MIME-Base64-3.05
virtual/perl-digest-base-1.13
app-admin/eselect-1.0
sys-apps/eject-2.1.0-r1
sys-power/acpid-1.0.4-r3
x11-libs/openmotif-2.2.3-r9
media-libs/lcms-1.14-r1
x11-wm/enlightenment-0.16.8
dev-libs/nspr-4.6.1-r2
sys-apps/usbutils-0.71-r1
media-gfx/imagemagick-6.2.5.5
dev-libs/gmp-4.1.4-r3
app-vim/gentoo-syntax-20051221
www-client/links-2.1_pre20
media-libs/id3lib-3.8.3-r4
x11-themes/gtk-engines-2.6.7
www-client/mozilla-launcher-1.45
net-dns/bind-tools-9.3.2
dev-libs/libtasn1-0.2.18
net-libs/gnutls-1.2.10

-Payton

Crap. I was hoping that my questions would shake loose a solution from
another quarter…
I’m kind of out of ideas. I don’t see anything in that emerge list that
would cause
problems with ruby… although, I’m no expert on linux library
dependencies.

What seems really weird about this is that third party rails apps still
work fine but your
code breaks. Are you doing anything “crazy” in your code? I have no idea
what “crazy”
might look like, but I guess anything that’s not like typical rails
coding.

You could also try to narrow down where the segfault is occuring with
breakpoints or log
statements. Maybe some piece of Ruby was installed outside of portage at
some point and is
still around, and somehow your code is going off into that old code…
where things aren’t
arranged in memory quite the way they should be.

As you can probably guess I’m kind of whiffing in the breeze here… I
don’t have any
solid ideas, just trying to give you some avenues of exploration.

Oh, and someone else was talking about suspecting memory when they get
segfaults, but I’ve
never thought that. Having done a little beginning programming in C, I’m
all too familiar
with how easy it is to segfault: just mess up where your pointers are
pointing and your
there! (Did that over and over and over… :slight_smile: )

good luck!

b

How long have you been running this gentoo install? Is it fairly new?

Are you sure your CFLAGS and MARCH or MCPU are set correctly in
make.conf? What arch are
you running?

Did you update GCC recently? If so, was it the 3.3.* to 3.4.* jump, cuz
that required an
upgrade to libtool and the installation of a libstdc++ compat library?

Did you use the rails/ruby packages from portage? Did you use masked
versions?

Did you check gentoo’s bugzilla for any reports of segfaults in
ruby/rails/etc?

What exactly was that last update you did? Rails/Ruby weren’t part of
that upgrade right?

b

I struggled with segfaults for about a month. The only thing that fixed
mine was:

gem uninstall mysql

I then dowloaded the latest ruby mysql bindings off the web and used
those. If you already disabled active record this probably won’t help
but thought I would mention it anyways.

Charlie
recentrambles.com

On Wed, 2006-02-22 at 09:45 -0800, Ben M. wrote:

still around, and somehow your code is going off into that old code… where things aren’t
good luck!

when this became a problem. I use ruby and rubygems from portage, but I

media-libs/imlib2-1.2.1.009
dev-libs/nspr-4.6.1-r2
net-libs/gnutls-1.2.10

Did you update GCC recently? If so, was it the 3.3.* to 3.4.* jump,
that upgrade right?

any given page which involves a controller once, and any subsequent
else to turn.


[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Charlie B.
Programmer
Castle Branch Inc.

I’ve actually encountered some of this on Windows recently, under
WEBrick and Mongrel.
I’m still trying to isolate a test case, sadly.

Here’s an example of what I’m seeing:
http://localhost:3000/plans/show/9937
/plans/list_by_be/2006/01/60910301
./script/…/config/…/vendor/rails/activerecord/lib/active_record/associations.rb:729:
[BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.

I don’t have MySQL installed; I only use Postgres and Oracle.