[MacRuby] #1352: Segfault occurs when invoked the Module#{class_variable_set, class_variable_get} within some threads.

MacRuby ruby-noreply at macosforge.org
Mon Jul 4 07:33:56 PDT 2011


#1352: Segfault occurs when invoked the Module#{class_variable_set,
class_variable_get} within some threads.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 m = Module.new
 th = Thread.new {
   1000.times do |i|
     m.class_variable_set(:"@@foo_#{i}", i)
   end
 }

 1000.times do |i|
   begin
     m.class_variable_get(:"@@foo_#{i}")
   rescue
   end
 end

 th.join
 }}}

 BackTrace:
 {{{
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
 0x00007fff83cc3c00 in strlen ()
 (gdb) t a a bt

 Thread 3 (process 25594):
 #0  0x00000001000ad36e in rb_str_intern_fast (str=0) at string.c:6298
 #1  0x0000000100134ccb in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:100
 #2  0x0000000100134ccb in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #3  0x0000000100134ccb in rb_vm_yield_args () at dispatcher.cpp:1278
 #4  0x00000001000db2fd in rb_vm_yield (argc=1, argv=0x10177f928) at
 vm.h:697
 #5  0x00000001000db2d0 in rb_yield (val=489) at vm_eval.c:183
 #6  0x000000010004d1da in int_dotimes (num=4001, sel=0x100fe7350) at
 numeric.c:3241
 #7  0x000000010012e8b4 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:159
 #8  0x000000010012e8b4 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #9  0x000000010012e8b4 in rb_vm_dispatch () at dispatcher.cpp:872
 #10 0x0000000101500744 in ?? ()
 #11 0x0000000101500c81 in ?? ()
 #12 0x0000000100132c67 in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:98
 #13 0x0000000100132c67 in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #14 0x0000000100132c67 in rb_vm_block_eval (b=0x200020960, argc=0,
 argv=0x0) at dispatcher.cpp:1228
 #15 0x000000010014d093 in rb_vm_thread_run (thread=8590067680) at
 vm.cpp:4856
 #16 0x00007fff83cf9fd6 in _pthread_start ()
 #17 0x00007fff83cf9e89 in thread_start ()
 Current language:  auto; currently c

 Thread 2 (process 25594):
 #0  0x00007fff833ee528 in
 Auto::visitAllocatedBlocks<Auto::scan_retained_and_old_blocks_visitor> ()
 #1  0x00007fff833ed944 in
 Auto::MemoryScanner::scan_retained_and_old_blocks ()
 #2  0x00007fff833e8a47 in Auto::Collector::check_roots ()
 #3  0x00007fff833ed8b1 in Auto::MemoryScanner::scan ()
 #4  0x00007fff833e277d in Auto::Zone::collect ()
 #5  0x00007fff833cba7e in auto_collect_internal ()
 #6  0x00007fff833cc0bd in auto_collection_work ()
 #7  0x00007fff83cfcd64 in _dispatch_call_block_and_release ()
 #8  0x00007fff83cdb8d2 in _dispatch_queue_drain ()
 #9  0x00007fff83cdb734 in _dispatch_queue_invoke ()
 #10 0x00007fff83cdb2de in _dispatch_worker_thread2 ()
 #11 0x00007fff83cdac08 in _pthread_wqthread ()
 #12 0x00007fff83cdaaa5 in start_wqthread ()

 Thread 1 (process 25594):
 #0  0x00007fff83cc3c00 in strlen ()
 #1  0x000000010012d622 in rb_vm_dispatch () at dispatcher.cpp:698
 #2  0x00000001000d9dc9 in rb_vm_call0 (vm=0x100f231c0, top=0,
 self=8590682912, klass=0x200037b60, sel=0x0, block=0x0, opt=2 '\002',
 argc=0, argv=0x0) at vm.h:654
 #3  0x00000001000daeee in rb_vm_call2 (block=0x0, self=8590682912,
 klass=8590162784, sel=0x0, argc=0, argv=0x0) at vm.h:679
 #4  0x00000001000dad8e in rb_call (recv=8590682912, mid=11488, argc=0,
 argv=0x0, scope=1, pass_current_block=false) at vm_eval.c:32
 #5  0x00000001000db111 in rb_funcall (recv=8590682912, mid=11488, n=0) at
 vm_eval.c:106
 #6  0x0000000100025490 in exc_message (exc=8590682912, sel=0x7fff880df27c)
 at error.c:455
 #7  0x000000010012e8b4 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:159
 #8  0x000000010012e8b4 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #9  0x000000010012e8b4 in rb_vm_dispatch () at dispatcher.cpp:872
 #10 0x0000000100025926 in rb_vm_call0 (vm=0x100f231c0, top=0,
 self=8590682912, klass=0x200037b60, sel=0x7fff880df27c, block=0x0, opt=2
 '\002', argc=0, argv=0x0) at vm.h:654
 #11 0x000000010002585f in rb_vm_call (self=8590682912, sel=0x7fff880df27c,
 argc=0, argv=0x0) at vm.h:661
 #12 0x00000001000277ed in format_message (exc=8590682912) at error.c:1274
 #13 0x0000000100139e2a in rb_ensure () at vm.cpp:3695
 #14 0x00000001000279a8 in rb_format_exception_message (exc=8590682912) at
 error.c:1314
 #15 0x00000001000c6925 in rb_rb2oc_exception (exc=8590682912) at
 objc.m:504
 #16 0x0000000100148868 in __vm_raise () at vm.cpp:3561
 #17 0x00000001001489fa in rb_vm_raise (exception=8590682912) at
 vm.cpp:3639
 #18 0x0000000100028bc3 in rb_exc_raise (mesg=8590682912) at eval.c:290
 #19 0x0000000100025c39 in rb_name_error (id=Could not find the frame base
 for "rb_name_error".
 ) at error.c:670
 #20 0x00000001000c10da in rb_cvar_get3 (klass=0, id=13110, check=true,
 defined=false) at variable.c:1827
 #21 0x00000001000c112e in rb_cvar_get2 (klass=8590068000, id=13110,
 check=true) at variable.c:1838
 #22 0x00000001000c1152 in rb_cvar_get (klass=8590068000, id=13110) at
 variable.c:1844
 #23 0x00000001000532ce in rb_mod_cvar_get (obj=8590068000,
 sel=0x100fc15d0, iv=8590682944) at object.c:2418
 #24 0x000000010012e8e6 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:161
 #25 0x000000010012e8e6 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #26 0x000000010012e8e6 in rb_vm_dispatch () at dispatcher.cpp:872
 #27 0x0000000101500744 in ?? ()
 #28 0x0000000101500db2 in ?? ()
 #29 0x0000000100134ccb in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:100
 #30 0x0000000100134ccb in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #31 0x0000000100134ccb in rb_vm_yield_args () at dispatcher.cpp:1278
 #32 0x00000001000db2fd in rb_vm_yield (argc=1, argv=0x7fff5fbfcc78) at
 vm.h:697
 #33 0x00000001000db2d0 in rb_yield (val=117) at vm_eval.c:183
 #34 0x000000010004d1da in int_dotimes (num=4001, sel=0x100fe7350) at
 numeric.c:3241
 #35 0x000000010012e8b4 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:159
 #36 0x000000010012e8b4 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #37 0x000000010012e8b4 in rb_vm_dispatch () at dispatcher.cpp:872
 #38 0x0000000101500744 in ?? ()
 #39 0x0000000101500224 in ?? ()
 #40 0x000000010014a072 in rb_vm_run (fname=0x2000a74c0
 "/Users/watson/tmp/t.rb", node=0x2000252a0, binding=0x0,
 inside_eval=false) at vm.cpp:4115
 #41 0x000000010002898b in ruby_run_node (n=0x2000252a0) at eval.c:211
 #42 0x0000000100000be3 in main (argc=2, argv=0x100f1c040,
 envp=0x7fff5fbfde58) at main.cpp:40
 (gdb)
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1352>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list