Project

General

Profile

Actions

Bug #12583

closed

Class#instance_methods dumps core

Added by shyouhei (Shyouhei Urabe) almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-07-13 trunk 55653) [x86_64-darwin15]
[ruby-dev:49731]

Description

次のようにすると core を吐きます。

% cat tmp.rb
ObjectSpace.each_object{|o|o.singleton_class rescue 0}
ObjectSpace.each_object(Module){|o|o.instance_methods}

% lldb -- ruby -v tmp.rb
(lldb) target create "/Users/urabe.shyouhei/data/etc/rbenv/versions/trunk@svn/bin/ruby"
Current executable set to '/Users/urabe.shyouhei/.rbenv/versions/trunk@svn/bin/ruby' (x86_64).
(lldb) settings set -- target.run-args  "-v" "tmp.rb"
(lldb) run
Process 96798 launched: '/Users/urabe.shyouhei/.rbenv/versions/trunk@svn/bin/ruby' (x86_64)
ruby 2.4.0dev (2016-07-13 trunk 55653) [x86_64-darwin15]
Process 96798 stopped
* thread #1: tid = 0x4bbb9, 0x0000000100178d45 ruby`rb_id_table_foreach [inlined] rb_id_serial_to_id at symbol.c:361, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x4d55545a)
    frame #0: 0x0000000100178d45 ruby`rb_id_table_foreach [inlined] rb_id_serial_to_id at symbol.c:361
   358  #endif
   359  rb_id_serial_to_id(rb_id_serial_t num)
   360  {
-> 361      if (is_notop_id((ID)num)) {
   362          VALUE sym = get_id_entry(num, ID_ENTRY_SYM);
   363          return SYM2ID(sym);
   364      }
(lldb) bt
* thread #1: tid = 0x4bbb9, 0x0000000100178d45 ruby`rb_id_table_foreach [inlined] rb_id_serial_to_id at symbol.c:361, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x4d55545a)
  * frame #0: 0x0000000100178d45 ruby`rb_id_table_foreach [inlined] rb_id_serial_to_id at symbol.c:361
    frame #1: 0x0000000100178d45 ruby`rb_id_table_foreach [inlined] key2id at id_table.c:216
    frame #2: 0x0000000100178d45 ruby`rb_id_table_foreach + 27 at id_table.c:1396
    frame #3: 0x0000000100178d2a ruby`rb_id_table_foreach [inlined] mix_id_table_foreach + 718 at id_table.c:1539
    frame #4: 0x0000000100178a5c ruby`rb_id_table_foreach(tbl=<unavailable>, func=(ruby`method_entry_i at class.c:1148), data=0x00007fff5fbfdce8) + 28 at id_table.c:1574
    frame #5: 0x000000010002f384 ruby`class_instance_method_list(argc=<unavailable>, argv=<unavailable>, mod=4317777480, obj=<unavailable>, func=<unavailable>) + 468 at class.c:1195
    frame #6: 0x00000001001bf0a0 ruby`vm_call_cfunc [inlined] vm_call_cfunc_with_frame + 190 at vm_insnhelper.c:1641
    frame #7: 0x00000001001befe2 ruby`vm_call_cfunc(th=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=<unavailable>, cc=<unavailable>) + 66 at vm_insnhelper.c:1736
    frame #8: 0x00000001001a9016 ruby`vm_exec_core(th=<unavailable>, initial=<unavailable>) + 12534 at insns.def:1064
    frame #9: 0x00000001001b94dd ruby`vm_exec(th=<unavailable>) + 125 at vm.c:1653
    frame #10: 0x00000001001b4887 ruby`rb_yield [inlined] invoke_block_from_c_splattable(th=<unavailable>, block=<unavailable>, self=<unavailable>, argc=0, argv=<unavailable>, blockptr=<unavailable>, cref=<unavailable>) + 183 at vm.c:990
    frame #11: 0x00000001001b487f ruby`rb_yield [inlined] vm_yield(th=<unavailable>, argc=0) at vm.c:1025
    frame #12: 0x00000001001b487f ruby`rb_yield [inlined] rb_yield_0(argc=0) at vm_eval.c:1019
    frame #13: 0x00000001001b487f ruby`rb_yield(val=<unavailable>) + 175 at vm_eval.c:1032
    frame #14: 0x000000010008dd48 ruby`os_obj_of_i(vstart=<unavailable>, vend=<unavailable>, stride=<unavailable>, data=<unavailable>) + 168 at gc.c:2490
    frame #15: 0x000000010007f9b3 ruby`objspace_each_objects(arg=<unavailable>) + 195 at gc.c:2358
    frame #16: 0x00000001000726b6 ruby`rb_ensure(b_proc=(ruby`objspace_each_objects at gc.c:2340), data1=140734799799296, e_proc=<unavailable>, data2=<unavailable>) + 166 at eval.c:900
    frame #17: 0x000000010007f72a ruby`rb_objspace_each_objects(callback=<unavailable>, data=<unavailable>) + 266 at gc.c:2428
    frame #18: 0x0000000100087eb7 ruby`os_each_obj [inlined] os_obj_of(of=<unavailable>) + 28 at gc.c:2506
    frame #19: 0x0000000100087e9b ruby`os_each_obj(argc=<unavailable>, argv=<unavailable>, os=4317810480) + 43 at gc.c:2558
    frame #20: 0x00000001001bf0a0 ruby`vm_call_cfunc [inlined] vm_call_cfunc_with_frame + 190 at vm_insnhelper.c:1641
    frame #21: 0x00000001001befe2 ruby`vm_call_cfunc(th=<unavailable>, reg_cfp=<unavailable>, calling=<unavailable>, ci=<unavailable>, cc=<unavailable>) + 66 at vm_insnhelper.c:1736
    frame #22: 0x00000001001a889f ruby`vm_exec_core(th=<unavailable>, initial=<unavailable>) + 10623 at insns.def:965
    frame #23: 0x00000001001b94dd ruby`vm_exec(th=<unavailable>) + 125 at vm.c:1653
    frame #24: 0x0000000100071690 ruby`ruby_exec_internal(n=0x00000001018578c8) + 144 at eval.c:244
    frame #25: 0x00000001000715a6 ruby`ruby_run_node [inlined] ruby_exec_node(n=<unavailable>) + 54 at eval.c:308
    frame #26: 0x0000000100071598 ruby`ruby_run_node(n=<unavailable>) + 40 at eval.c:300
    frame #27: 0x00000001000013b3 ruby`main(argc=<unavailable>, argv=<unavailable>) + 99 at main.c:36
    frame #28: 0x00007fff8f0be5ad libdyld.dylib`start + 1
(lldb)

Updated by shyouhei (Shyouhei Urabe) almost 8 years ago

  • Description updated (diff)
Actions #2

Updated by ko1 (Koichi Sasada) almost 8 years ago

  • Status changed from Open to Closed

Applied in changeset r55663.


  • gc.c (gc_mark_roots): should mark the VM object itself to mark
    singleton class of the VM object.
    Before this patch, we only set mark bit for the VM object and
    invoke mark function separately.
    [Bug #12583]

  • test/ruby/test_gc.rb: add a test.

Updated by nagachika (Tomoyuki Chikanaga) almost 8 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: DONTNEED, 2.2: REQUIRED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r55919 merged revision(s) 55663.

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: REQUIRED, 2.3: DONE to 2.1: DONTNEED, 2.2: DONE, 2.3: DONE

ruby_2_2 r55921 merged revision(s) 55663.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0