Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 123718 - rails segfaults after 2 HTTP requests
Summary: rails segfaults after 2 HTTP requests
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-22 08:30 UTC by payton
Modified: 2006-03-01 06:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Stack trace of a segmentation fault (rails_stack_trace,128.84 KB, text/plain)
2006-02-22 12:13 UTC, payton
Details
Debug ruby stack trace after segfault (rails_stack_trace4,190.31 KB, text/plain)
2006-02-23 14:20 UTC, payton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description payton 2006-02-22 08:30:50 UTC
When running a rails app using webrick or mongrel, I can load any given page (involving a controller) once, and any subsequent page loads trigger a "Segmentation fault" without any other info. If I use ruby18_with_gems I get this: 
"/usr/bin/ruby: line 1: 11610 Segmentation fault      RUBYOPT="-rubygems" /usr/bin/ruby18 "$@""

This problem is very new, and has only started occurring since I last updated my Gentoo linux system.  It's not my application specifically; I've tried a creating a brand-new application which has the same problem. It's not all of ruby; instiki works just fine and so do basic, html-loading instances of webrick.  The rails mailing list has not seen this occur.

I did try recompiling ruby and reinstalling the rails gem (as well as activerecord, actionpack, actionmailer, actionwebservice, activesupport). 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 has been no change in the problem.

This is a list of the packages I emerged just before this problem started:
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 

Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2, 2.6.13-gentoo-r3 i686)
=================================================================
System uname: 2.6.13-gentoo-r3 i686 Intel(R) Pentium(R) M processor 1.86GHz
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i386-pc-linux-gnu"
CFLAGS="-O2 -mcpu=i686"
CHOST="i386-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -mcpu=i686"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://gentoo.chem.wisc.edu/gentoo/ http://cudlug.cudenver.edu/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="x86 X aac aim alsa apache2 apm arts audiofile avi berkdb bitmap-fonts bonobo browserplugin bzip2 cdb cdparanoia cdr cli crypt cups curl dba directfb divx4linux dvd dvdr emboss encode esd ethereal exif expat fam firefox foomaticdb fortran gd gdbm gif glut gmp gnome gpm gstreamer gtk gtk2 gtkhtml idn imagemagick imap imlib jabber java javascript jpeg lcms ldap libg++ libwww mad maildir mhash mikmod mng motif mozdevelop mp3 mpeg mysql ncurses nls ogg oggvorbis opengl oracle oscar oss pam pcre pdflib perl php png python quicktime readline real ruby samba sasl sdk sdl soap spell ssl tcpd threads tiff truetype truetype-fonts type1-fonts udev usb vorbis wifi win32codecs xml xml2 xmms xpm xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2006-02-22 08:48:05 UTC
use ruby-config to change your default ruby back to ruby18 instead of ruby_with_gems.
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2006-02-22 08:48:45 UTC
I think ruby18_with_gems is cursed, and I need to remove it.
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2006-02-22 10:55:58 UTC
I've just added a rubygems -r4 package which I think helps with this, but I recommend not using ruby18_with_gems anymore.
Comment 4 payton 2006-02-22 11:07:09 UTC
(In reply to comment #3)
> I've just added a rubygems -r4 package which I think helps with this, but I
> recommend not using ruby18_with_gems anymore.

I actually wasn't using ruby18_with_gems except briefly to see if it helped with the segfaults.  It had no effect except to print slightly more information.  I'll try the -r4 package as soon as I can find it. 

Comment 5 Caleb Tennis (RETIRED) gentoo-dev 2006-02-22 11:27:31 UTC
The segfault happens in webrick/mongrel, right?

Can you run webrick/mongrel in gdb and get a backtrace?
Comment 6 payton 2006-02-22 12:13:55 UTC
Created attachment 80449 [details]
Stack trace of a segmentation fault
Comment 7 payton 2006-02-23 10:50:21 UTC
Problem still occurs. I added a stack trace of a crash with webrick. 

I also tried to emerge the -r4 rubygems in hopes that might help, but I constantly get a digest verification error.  Could be my mirrors' fault, I suppose.  Anyway, I doubt the problem is with rubygems, since the emerge which broke rails did not include a rubygems upgrade.  

I still have a nearly identical gentoo box which has not yet performed that emerge, and rails does not have this issue there.
Comment 8 Caleb Tennis (RETIRED) gentoo-dev 2006-02-23 12:50:17 UTC
Yikes!

I'm a bit baffled by that.  Can you re-emerge ruby with debug symbols (USE="debug") and try er again, so we'll get line numbers of the source in the stack trace.

We may have to send it to the ruby-core folks..
Comment 9 payton 2006-02-23 14:19:21 UTC
Following the Gentoo instructions here (http://www.gentoo.org/doc/en/bugzilla-howto.xml) I generated a much more detailed backtrace, which I'm attaching here.

It's interesting: the first thing it says is "rb_eval (self=7909646, n=0xb75c4ba8) at eval.c:2833
2833    eval.c: No such file or directory.
        in eval.c
"

That definitely sounds like useful information.  Hopefully someone can understand it.
Comment 10 payton 2006-02-23 14:20:13 UTC
Created attachment 80561 [details]
Debug ruby stack trace after segfault
Comment 11 Caleb Tennis (RETIRED) gentoo-dev 2006-02-24 05:12:29 UTC
to clarify, you're using ruby 1.8.4, right?

(What does /usr/bin/ruby symlink point to?)
Comment 12 payton 2006-02-24 06:24:49 UTC
/usr/bin/ruby -> ruby18
Comment 13 Caleb Tennis (RETIRED) gentoo-dev 2006-02-27 06:33:23 UTC
I am going to commit a new ruby to portage - 1.8.4.20060226 which is a snapshot of 1.8.4 as of today.  Can you try it out and see if it helps? Otherwise, I recommend submitting a bug report at rubyforge.org, as this looks to be happening in the ruby interpreter and seems to be a grave bug indeed.
Comment 14 payton 2006-02-28 07:50:47 UTC
(In reply to comment #13)
> I am going to commit a new ruby to portage - 1.8.4.20060226 which is a snapshot
> of 1.8.4 as of today.  Can you try it out and see if it helps? 

Same problem. I've submitted a bug to rubyforge.  Thanks for the help.

http://rubyforge.org/tracker/index.php?func=detail&aid=3683&group_id=426&atid=1698

Comment 15 payton 2006-03-01 06:52:56 UTC
I tried using a newly compiled stable ruby release, and
there was no change. 

However: 

I then noticed that running a rails application as another
user on the same machine had no problems.  I figured it
couldn't possibly be permissions, so I started removing
things from my home directory to see if it would help.  

Below is a list of files I removed and, somehow, removing
them has solved the problem.  Call me foolish perhaps for
not trying this before, but it seems troubling that some
rcfiles could cause ruby to segfault.  I wondered if it was
my .gem directory, but I think it was empty...

  868  rm -rf .rbbr 
  869  rm -rf .rssowl/
  874  rm -rf .vmware
  881  rm -rf .adesklets 
  882  rm -rf .audacity 
  883  rm -rf .crash_reportrc 
  888  rm -rf .fltk/
  892  rm -rf .gem/
  895  rm -rf .gstreamer-0.8/
  899  rm -rf .install4j 
  902  rm -rf .irbrc 

Thank you for the assistance!