Bug #2558


r24591 causes Segfault

Added by a3li (Alex Legler) over 12 years ago. Updated about 11 years ago.

Target version:
ruby -v:
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]


While looking into a test failure in test_thread.rb (ticket #2506), I stumbled upon a segmentation fault that was randomly happening.

To reproduce, run make test', or the extracted sample (attached) while redirecting output. i.e. ./ruby19 ~/reprod.rb > /dev/null' multiple times, until randomly a segv occurs.
The segfault only seems to occur on systems with a glibc >= 2.10, I reproduced it on Gentoo x86 with glibc 2.10 and amd64 with glibc 2.11.

I "bisected" my way through the changes between 1.9.1_p243 and 1.9.1_p376 and found that r24591 (applied in the 1_9_1 branch in r25539) is the cause. If I take a pristine p376 snapshot and just revert the aforementioned change, the issue goes away.

This is what the crash output looks like:

/home/alex/file.rb:114: [BUG] Segmentation fault
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]

-- control frame ----------
c:0003 p:0000 s:0007 b:0007 l:001f88 d:000006 BLOCK /home/alex/file.rb:114
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP

-- Ruby level backtrace information-----------------------------------------
/home/alex/file.rb:114:in `block (2 levels) in '

-- C level backtrace information -------------------------------------------
0x7f8e9a8443d1 ./ [0x7f8e9a8443d1]
0x7f8e9a76caae ./ [0x7f8e9a76caae]
0x7f8e9a76cc13 ./ [0x7f8e9a76cc13]
0x7f8e9a7eebb5 ./ [0x7f8e9a7eebb5]
0x7f8e9a50f010 /lib/ [0x7f8e9a50f010]
0x72e6e0 [0x72e6e0]

You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details:

Note that file.rb is what I attach as reprod.rb and does not have 114 lines!

Please also find more info from gdb attached.


reprod.rb (171 Bytes) reprod.rb Reproducer a3li (Alex Legler), 01/05/2010 06:28 PM
ruby-backtrace.txt (98.4 KB) ruby-backtrace.txt Backtraces from gdb a3li (Alex Legler), 01/05/2010 06:28 PM

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #1813: Threading seg fault (1.9.1-p129 Linux/Mac)Closedkosaki (Motohiro KOSAKI)07/24/2009Actions
Related to Ruby master - Feature #1952: cannot stop with Ctrl+CClosedko1 (Koichi Sasada)08/18/2009Actions

Also available in: Atom PDF