[ruby-dev:24325] shared array dumps core

From: Tanaka Akira <akr@...17n.org>
Date: 2004-09-23 14:03:32 UTC
List: ruby-dev #24325
次のようにすると core を吐きます。

% ./ruby -e '
arr = (1..10).to_a
arr.shift
p arr
ObjectSpace.each_object(Array) {|v|
  if v.length == 10
    v.replace [100]
  end
}
7000.times {|i| i.to_s }
p arr
'
[2, 3, 4, 5, 6, 7, 8, 9, 10]
-e:11: [BUG] Segmentation fault
ruby 1.9.0 (2004-09-22) [i686-linux]

zsh: abort (core dumped)  ./ruby -e 
% gdb ruby core
GNU gdb 6.1-debian
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 "i386-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

Core was generated by `./ruby -e 
arr = (1..10).to_a
arr.shift
p arr
ObjectSpace.each_object(Array) {|'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x4009e721 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4009e721 in kill () from /lib/libc.so.6
#1  0x4009e4c5 in raise () from /lib/libc.so.6
#2  0x4009f9e8 in abort () from /lib/libc.so.6
#3  0x080d1cf6 in rb_bug (fmt=0x0) at error.c:214
#4  0x080afd02 in sigsegv (sig=11) at signal.c:446
#5  <signal handler called>
#6  st_lookup (table=0x650000, key=3169, value=0xbfffe9e8) at st.c:258
#7  0x08054083 in search_method (klass=135503040, id=3169, origin=0xbfffea14) at eval.c:380
#8  0x080540d9 in rb_get_method_body (klassp=0xbfffea70, idp=0xbfffea54, noexp=0xbfffea58) at eval.c:401
#9  0x0805e2ca in rb_call (klass=135503040, recv=1075466240, mid=3169, argc=0, argv=0x0, scope=1) at eval.c:5708
#10 0x0805e6f4 in rb_funcall (recv=1075466240, mid=6619136, n=0) at ruby.h:635
#11 0x08085dc6 in rb_inspect (obj=6619136) at object.c:345
#12 0x080c51d1 in inspect_ary (ary=1075607896) at array.c:1539
#13 0x080c4f38 in inspect_call (arg=0x650000) at array.c:1458
#14 0x0805d449 in rb_ensure (b_proc=0x80c4f20 <inspect_call>, data1=3221220352, e_proc=0x80c5020 <inspect_ensure>, 
    data2=1075607896) at eval.c:5180
#15 0x080c50df in rb_protect_inspect (func=0x80c5130 <inspect_ary>, obj=1075607896, arg=0) at array.c:1515
#16 0x080c5286 in rb_ary_inspect (ary=1075607896) at array.c:1562
#17 0x08069e31 in call_cfunc (func=0x80c5230 <rb_ary_inspect>, recv=1075607896, len=6619136, argc=135296216, argv=0x0)
    at eval.c:5374
#18 0x0805e0c7 in rb_call0 (klass=1075647616, recv=1075607896, id=3169, oid=6619136, argc=0, argv=0x0, body=0x401d137c, 
    nosuper=0) at eval.c:5511
#19 0x0805e378 in rb_call (klass=1075647616, recv=1075607896, mid=3169, argc=0, argv=0x0, scope=1) at eval.c:5732
#20 0x0805e6f4 in rb_funcall (recv=1075607896, mid=6619136, n=0) at ruby.h:635
#21 0x08085dc6 in rb_inspect (obj=6619136) at object.c:345
#22 0x080797f1 in rb_p (obj=6619136) at io.c:3747
#23 0x080798a2 in rb_f_p (argc=1, argv=0xbffff128) at io.c:3777
#24 0x08069e2a in call_cfunc (func=0x8079830 <rb_f_p>, recv=1075673496, len=6619136, argc=135296216, argv=0xbffff128)
    at eval.c:5371
#25 0x0805e0c7 in rb_call0 (klass=1075678376, recv=1075673496, id=7417, oid=6619136, argc=1, argv=0xbffff128, 
    body=0x401cea3c, nosuper=0) at eval.c:5511
#26 0x0805e378 in rb_call (klass=1075678376, recv=1075673496, mid=7417, argc=1, argv=0xbffff128, scope=1) at eval.c:5732
#27 0x080592b8 in rb_eval (self=1075673496, n=0x650000) at ruby.h:635
#28 0x0805584b in ruby_exec () at eval.c:1460
#29 0x08055890 in ruby_run () at eval.c:1486
#30 0x08053955 in main (argc=6619136, argv=0x650000, envp=0xbffff904) at main.c:38
(gdb) 
-- 
[田中 哲][たなか あきら][Tanaka Akira]

In This Thread

Prev Next