[Ruby 1.9 - Bug #4268] FIBER USE NATIVE を undef していると GC.stress 下で Enumerable#zip が core

Issue #4268 has been updated by Makoto K…

HEADで再現しませんでした。取り急ぎ

Bug #4268: FIBER_USE_NATIVE を undef していると GC.stress 下で Enumerable#zip が
core

Author: Makoto K.
Status: Assigned
Priority: Low
Assignee: Koichi Sasada
Category: core
Target version:
ruby -v: ruby 1.9.3dev (2011-01-11 trunk 30510) [x86_64-freebsd8.2]

=begin
r27635 (FIBER_USE_NATIVE パッチ取り入れ)以後の trunk で、
#undef FIBER_USE_NATIVE していると発生するのですが、以下の
ようなスクリプトで core を吐きます。

$ cat foo.rb
GC.stress = true

obj = Object.new
class << obj
include Enumerable
def each
yield 1
end
end

obj.zip({a: “A”}) {|x, y|}

$ ruby19 foo.rb
foo.rb:7: [BUG] Segmentation fault
ruby 1.9.3dev (2011-01-11 trunk 30510) [x86_64-freebsd8.2]

– Control frame information

c:0008 p:---- s:0021 b:0021 l:000020 d:000020 FINISH
c:0007 p:---- s:0019 b:0019 l:000010 d:000018 IFUNC
c:0006 p:0009 s:0017 b:0016 l:000015 d:000015 METHOD foo.rb:7
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :zip
c:0003 p:0064 s:0007 b:0007 l:0016b8 d:001ef0 EVAL foo.rb:11
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0016b8 d:0016b8 TOP

– Ruby level backtrace information

foo.rb:11:in <main>' foo.rb:11:in zip’
foo.rb:7:in `each’

– Other runtime information

  • Loaded script: foo.rb

  • Loaded features:

    0 enumerator.so
    1 /usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/encdb.so
    2 /usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/trans/transdb.so

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6 (core dumped)

$ gdb ruby19 ruby19.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for
details.
This GDB was configured as “amd64-marcel-freebsd”…
Core was generated by `ruby19’.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/local/lib/libruby.so.19…done.
Loaded symbols for /usr/local/lib/libruby.so.19
Reading symbols from /usr/local/lib/libexecinfo.so.1…done.
Loaded symbols for /usr/local/lib/libexecinfo.so.1
Reading symbols from /lib/libthr.so.3…done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /usr/lib/librt.so.1…done.
Loaded symbols for /usr/lib/librt.so.1
Reading symbols from /lib/libcrypt.so.5…done.
Loaded symbols for /lib/libcrypt.so.5
Reading symbols from /lib/libm.so.5…done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libc.so.7…done.
Loaded symbols for /lib/libc.so.7
Reading symbols from
/usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/encdb.so…done.
Loaded symbols for
/usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/encdb.so
Reading symbols from
/usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/trans/transdb.so…done.
Loaded symbols for
/usr/local/lib/ruby/1.9.1/x86_64-freebsd8.2/enc/trans/transdb.so
Reading symbols from /libexec/ld-elf.so.1…done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x0000000800f290dc in thr_kill () from /lib/libc.so.7
[New Thread 80120ae40 (LWP 100560)]
[New Thread 8012041c0 (LWP 100762)]
(gdb) bt
#0 0x0000000800f290dc in thr_kill () from /lib/libc.so.7
#1 0x0000000800fc5dcb in abort () from /lib/libc.so.7
#2 0x000000080069dab8 in rb_bug (fmt=Variable “fmt” is not available.
) at …/error.c:273
#3 0x00000008007519ac in sigsegv (sig=Variable “sig” is not available.
) at …/signal.c:624
#4
#5 st_lookup (table=0x0, key=1296, value=0x7fffffffdb68) at
…/st.c:330
#6 0x00000008007bc71f in rb_check_funcall (recv=34379984480, mid=1296,
argc=0, argv=0x0) at vm_method.c:402
#7 0x00000008006e8696 in convert_type (val=34379984480,
tname=0x8007d063d “Array”, method=0x8007d066f “to_ary”, raise=0)
at …/object.c:1983
#8 0x00000008006ea7db in rb_check_convert_type (val=34379984480,
type=7, tname=0x8007d063d “Array”, method=0x8007d066f “to_ary”)
at …/object.c:2020
#9 0x00000008007bf0f5 in invoke_block_from_c (th=0x801217300,
block=0x80134af20, self=34380358880, argc=1, argv=Variable “argv” is not
available.
)
at vm_insnhelper.c:816
#10 0x00000008007bf4f4 in rb_yield (val=34379984480) at …/vm.c:591
#11 0x00000008006987b0 in zip_i (val=Variable “val” is not available.
) at …/enum.c:1940
#12 0x00000008007b51fa in vm_exec_core (th=0x801217300,
initial=Variable “initial” is not available.
) at vm_insnhelper.c:729
#13 0x00000008007baeae in vm_exec (th=0x801217300) at …/vm.c:1156
#14 0x00000008007bc524 in vm_call0 (th=0x801217300, recv=34379984840,
id=Variable “id” is not available.
) at vm_eval.c:66
#15 0x00000008007c0a90 in iterate_method (obj=Variable “obj” is not
available.
) at vm_eval.c:235
#16 0x00000008007abb86 in rb_iterate (it_proc=0x8007c0930
<iterate_method>, data1=140737488347824, bl_proc=0x8006985a0 <zip_i>,
data2=Variable “data2” is not available.
)
at vm_eval.c:862
#17 0x00000008007abd2b in rb_block_call (obj=Variable “obj” is not
available.
) at vm_eval.c:942
#18 0x0000000800697254 in enum_zip (argc=1, argv=Variable “argv” is not
available.
) at …/enum.c:2001
#19 0x00000008007b1330 in vm_call_method (th=0x801217300,
cfp=0x80134aef8, num=Variable “num” is not available.
) at vm_insnhelper.c:403
#20 0x00000008007b3ac6 in vm_exec_core (th=0x801217300,
initial=Variable “initial” is not available.
) at insns.def:1010
#21 0x00000008007baeae in vm_exec (th=0x801217300) at …/vm.c:1156
#22 0x00000008007bb18b in rb_iseq_eval_main (iseqval=34380183920) at
…/vm.c:1397
#23 0x00000008006a199f in ruby_exec_internal (n=0x80137f970) at
…/eval.c:225
#24 0x00000008006a19c9 in ruby_exec_node (n=0x80137f970) at
…/eval.c:272
#25 0x00000008006a37af in ruby_run_node (n=0x80137f970) at
…/eval.c:265
#26 0x0000000000400902 in main (argc=2, argv=0x7fffffffe918) at
…/main.c:38
=end