Mantis - ruby
Viewing Issue Advanced Details
4399 regular use minor sometimes 2010-04-16 18:09 2010-12-04 20:00
nutznboltz  
bwalton  
normal  
closed  
fixed  
none    
none  
0004399: Segmentation Fault in Garbage Collection for Ruby 1.8.7 prior to Dec 2009
A known bug exists in Ruby that causes it crash with segmentation faults (SIGSEGV, signal 11, etc.) when it allocates objects frequently.

This is causing the Ops Code Chef client to crash on our Solaris 10 systems.

A upstream fix was released. Could someone rebuild the OpenCSW Ruby from the latest 1.8.7 sources?
http://www.ruby-forum.com/topic/161876 [^]

``With 1.8.7, the ruby developers chose to change both the public APIs and aspects of the GC/memory management internals.''

http://www.ruby-forum.com/topic/198545 [^]

``Ruby-core > [Bug 0002326] 1.8.7 Segmentation fault''
Issue History
2010-04-16 18:09 nutznboltz New Issue
2010-04-17 03:18 bwalton Note Added: 0007868
2010-04-17 03:18 bwalton Assigned To => bwalton
2010-04-17 03:18 bwalton Status new => acknowledged
2010-04-19 15:56 nutznboltz Note Added: 0007890
2010-06-15 21:47 nutznboltz Note Added: 0008030
2010-06-15 22:16 nutznboltz Note Added: 0008031
2010-06-16 17:18 nutznboltz Note Added: 0008034
2010-06-16 17:34 nutznboltz Note Added: 0008035
2010-06-16 21:46 nutznboltz Note Added: 0008036
2010-06-16 21:55 nutznboltz Note Edited: 0008036
2010-07-13 03:15 bwalton Note Added: 0008108
2010-07-14 04:46 bwalton Note Added: 0008111
2010-07-22 21:41 nutznboltz Note Added: 0008129
2010-07-22 22:21 nutznboltz Note Added: 0008130
2010-07-29 18:25 nutznboltz Note Added: 0008145
2010-07-31 04:12 bwalton Note Added: 0008151
2010-10-28 03:54 bwalton Note Added: 0008424
2010-10-31 13:39 bwalton Note Added: 0008426
2010-12-04 19:22 bwalton Note Added: 0008519
2010-12-04 19:45 nutznboltz Note Added: 0008520
2010-12-04 19:59 bwalton Note Added: 0008521
2010-12-04 20:00 bwalton Status acknowledged => closed
2010-12-04 20:00 bwalton Resolution open => fixed

Notes
(0007868)
bwalton   
2010-04-17 03:18   
I'll get to this asap. Currently, I'm unable to update the rbconfig.rb.GCC4 due to a gcc4 bug.

Will queue.
(0007890)
nutznboltz   
2010-04-19 15:56   
Thank you kindly!
(0008030)
nutznboltz   
2010-06-15 21:47   
Is your problem:
ld.so.1: ruby: fatal: libgcc_s.so.1: open failed: No such file or directory

You can work around that by invoking configure with DLDFLAGS=-Wl,-R,/opt/csw/gcc4/lib

My complete configure options are:

--prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/opt/csw/etc --sharedstatedir=/opt/csw/share --localstatedir=/opt/csw/var --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --includedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-pthread --enable-shared --with-tcl-dir=/opt/csw --with-tk-dir=/opt/csw --with-dbm-dir=/opt/csw --with-gdbm-dir=/opt/csw --with-iconv-dir=/opt/csw --with-openssl-dir=/opt/csw --with-readline-dir=/opt/csw --with-zlib-dir=/opt/csw --enable-install-doc CC=/opt/csw/gcc4/bin/gcc 'CFLAGS=-mtune=i686 -O2 -pipe -m32 -march=i386 -I/opt/csw/include' 'LDFLAGS=-L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib' CPPFLAGS=-I/opt/csw/include DLDFLAGS=-Wl,-R,/opt/csw/gcc4/lib
(0008031)
nutznboltz   
2010-06-15 22:16   
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-solaris2.10]

$ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]'
 '--prefix=/opt/csw' '--exec_prefix=/opt/csw' '--bindir=/opt/csw/bin' '--sbindir=/opt/csw/sbin' '--libexecdir=/opt/csw/libexec' '--datadir=/opt/csw/share' '--sysconfdir=/opt/csw/etc' '--sharedstatedir=/opt/csw/share' '--localstatedir=/opt/csw/var' '--libdir=/opt/csw/lib' '--infodir=/opt/csw/share/info' '--includedir=/opt/csw/include' '--mandir=/opt/csw/share/man' '--enable-pthread' '--enable-shared' '--with-tcl-dir=/opt/csw' '--with-tk-dir=/opt/csw' '--with-dbm-dir=/opt/csw' '--with-gdbm-dir=/opt/csw' '--with-iconv-dir=/opt/csw' '--with-openssl-dir=/opt/csw' '--with-readline-dir=/opt/csw' '--with-zlib-dir=/opt/csw' '--enable-install-doc' 'CC=/opt/csw/gcc4/bin/gcc' 'CFLAGS=-mtune=i686 -O2 -pipe -m32 -march=i386 -I/opt/csw/include' 'LDFLAGS=-L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib' 'CPPFLAGS=-I/opt/csw/include' 'DLDFLAGS=-Wl,-R,/opt/csw/gcc4/lib'
(0008034)
nutznboltz   
2010-06-16 17:18   
http://redmine.ruby-lang.org/issues/show/2247 [^]
says: {{ Also, when compiling with a recent gcc at optimization level -O2 (or higher), util.c throws a number of warnings about breaking strict-aliasing rules. There is no /easy/ fix for this, but the work-around is to simply compile that one file with -fno-strict-aliasing ... }}
(0008035)
nutznboltz   
2010-06-16 17:34   
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-solaris2.10]

$ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]'
 '--prefix=/opt/csw' '--exec_prefix=/opt/csw' '--bindir=/opt/csw/bin' '--sbindir=/opt/csw/sbin' '--libexecdir=/opt/csw/libexec' '--datadir=/opt/csw/share' '--sysconfdir=/opt/csw/etc' '--sharedstatedir=/opt/csw/share' '--localstatedir=/opt/csw/var' '--libdir=/opt/csw/lib' '--infodir=/opt/csw/share/info' '--includedir=/opt/csw/include' '--mandir=/opt/csw/share/man' '--enable-pthread' '--enable-shared' '--with-tcl-dir=/opt/csw' '--with-tk-dir=/opt/csw' '--with-dbm-dir=/opt/csw' '--with-gdbm-dir=/opt/csw' '--with-iconv-dir=/opt/csw' '--with-openssl-dir=/opt/csw' '--with-readline-dir=/opt/csw' '--with-zlib-dir=/opt/csw' '--enable-install-doc' 'CC=/opt/csw/gcc4/bin/gcc' 'CFLAGS=-mtune=i686 -O2 -fno-strict-aliasing -pipe -m32 -march=i386 -I/opt/csw/include' 'LDFLAGS=-L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib' 'CPPFLAGS=-I/opt/csw/include' 'DLDFLAGS=-R/opt/csw/gcc4/lib'
(0008036)
nutznboltz   
2010-06-16 21:46   
(edited on: 2010-06-16 21:55)
Unfortunately, Chef and Puppet get stuck looping on:
lwp_park(0xFE46EF30, 0) Err#62 ETIME
with that Ruby.

Attempting with --disable-fastthread does not improve this situation.

Chef and Puppet work fine with
$ ruby --version
ruby 1.8.6 (2010-02-05 patchlevel 399) [i386-solaris2.10]


$ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]' '--prefix=/opt/csw' '--exec_prefix=/opt/csw' '--bindir=/opt/csw/bin' '--sbindir=/opt/csw/sbin' '--libexecdir=/opt/csw/libexec' '--datadir=/opt/csw/share' '--sysconfdir=/opt/csw/etc' '--sharedstatedir=/opt/csw/share' '--localstatedir=/opt/csw/var' '--libdir=/opt/csw/lib' '--infodir=/opt/csw/share/info' '--includedir=/opt/csw/include' '--mandir=/opt/csw/share/man' '--enable-pthread' '--enable-shared' '--enable-install-doc' 'CC=/opt/csw/gcc4/bin/gcc' 'CFLAGS=-mtune=i686 -O2 -fno-strict-aliasing -pipe -m32 -march=i386 -I/opt/csw/include' 'LDFLAGS=-L/opt/csw/gcc4/lib/. -m32 -march=i386 -R /opt/csw/gcc4/lib -L/opt/csw/lib' 'CPPFLAGS=-I/opt/csw/include' 'DLDFLAGS=-R/opt/csw/gcc4/lib'

(0008108)
bwalton   
2010-07-13 03:15   
I'm hoping to have updated packages in my experimental repo by tomorrow. Sorry for the long delay on this.
(0008111)
bwalton   
2010-07-14 04:46   
Please test the updated packages available from: http://mirror.opencsw.org/experimental.html#bwalton [^]

Thanks.
(0008129)
nutznboltz   
2010-07-22 21:41   
$ ruby --version
ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-solaris2.9]

$ ruby -r rbconfig -e 'puts Config::CONFIG["configure_args"]'
 '--prefix=/opt/csw' '--exec_prefix=/opt/csw' '--bindir=/opt/csw/bin' '--sbindir=/opt/csw/sbin' '--libexecdir=/opt/csw/libexec' '--datadir=/opt/csw/share' '--sysconfdir=/opt/csw/etc' '--sharedstatedir=/opt/csw/share' '--localstatedir=/opt/csw/var' '--libdir=/opt/csw/lib' '--infodir=/opt/csw/share/info' '--includedir=/opt/csw/include' '--mandir=/opt/csw/share/man' '--enable-pthread' '--enable-shared' '--with-tcl-dir=/opt/csw' '--with-tk-dir=/opt/csw' '--with-dbm-dir=/opt/csw/bdb48' '--with-gdbm-dir=/opt/csw' '--with-iconv-dir=/opt/csw' '--with-openssl-dir=/opt/csw' '--with-readline-dir=/opt/csw' '--with-zlib-dir=/opt/csw' '--enable-install-doc' 'CC=/opt/studio/SOS12/SUNWspro/bin/cc' 'CFLAGS=-xO3 -m32 -xarch=386 -xnorunpath' 'LDFLAGS=-L/opt/csw/lib' 'CPPFLAGS=-I/opt/csw/include'
(0008130)
nutznboltz   
2010-07-22 22:21   
I have installed the ruby and rubydev packages and Chef and Puppet are running to completion without errors. They are run every 30 minutes from cron. I'll let you know how they are again tomorrow.
(0008145)
nutznboltz   
2010-07-29 18:25   
I'm still getting E-mail from cron about chef-client segfaulting with the Ruby 1.8.7p299 you provided.

I'm not seeing any E-mail from the zones running chef-client on Ruby 1.8.6p399 I built.
(0008151)
bwalton   
2010-07-31 04:12   
Ok, but down-revving ruby isn't really an option...Let me dig around a bit and see if there are any 'test' patches that can be applied.
(0008424)
bwalton   
2010-10-28 03:54   
I'm rolling a new package with a patch that will hopefully address this issue. Will you be able to test them when they're ready?

Thanks
-Ben
(0008426)
bwalton   
2010-10-31 13:39   
Ok, there are updated ruby packages available here: http://buildfarm.opencsw.org/experimental.html#ruby [^]

Aside from the patch to (hopefully) fix the GC segfault, there is also a change to the libruby.so.1 SONAME. These changes will likely break binary gems and I'm still determining the best course of action (short term, simply install CSWrubydev). You should still be able to perform the testing required to ensure the GC issue is or is not handled though.
(0008519)
bwalton   
2010-12-04 19:22   
Ok, this seems to work ok. Can you verify it against your segfault issue. I'd like to release these...
(0008520)
nutznboltz   
2010-12-04 19:45   
It all works great! Thanks so much!
(0008521)
bwalton   
2010-12-04 19:59   
Pushed to release.

-Ben