[MacRuby] #1350: Segfault occurs when invoked an alias within some threads

MacRuby ruby-noreply at macosforge.org
Mon Jul 4 01:06:52 PDT 2011


#1350: Segfault occurs when invoked an alias within some threads
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 class Foo
   def bar(str)
     puts str
   end
 end

 f1 = Foo.new
 f2 = f1.clone

 th = Thread.new {
   1000.times do |i|
     f1.instance_eval{ alias :"f1_#{i}" :bar }
   end
 }

 1000.times do |i|
   f2.instance_eval{ alias :"f2_#{i}" :bar }
 end

 th.join
 f1.f1_99 "f1"
 f2.f2_10 "f2"
 }}}

 BackTrace 1:
 {{{
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
 0x00007fff83cc3c00 in strlen ()
 (gdb) bt
 #0  0x00007fff83cc3c00 in strlen ()
 #1  0x000000010014714b in vm_alias (outer=8590023776, name=13096,
 def=12368) at vm.cpp:1575
 #2  0x000000010014760e in rb_vm_alias2 (outer=8590023776, name=8590664256,
 def=8590082816, dynamic_class=1 '\001') at vm.cpp:1614
 #3  0x0000000101601689 in ?? ()
 #4  0x0000000100135ddb in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:98
 #5  0x0000000100135ddb in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #6  0x0000000100135ddb in rb_vm_yield_under () at dispatcher.cpp:1321
 #7  0x00000001000db958 in specific_eval (argc=0, argv=0x0,
 klass=8590023776, self=8590023136) at vm_eval.c:339
 #8  0x00000001000dbee3 in rb_obj_instance_eval_imp (self=8590023136,
 sel=0x100fde130, top=8590062336, argc=0, argv=0x0) at vm_eval.c:507
 #9  0x000000010012e366 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:457
 #10 0x000000010012e366 in rb_vm_dispatch () at dispatcher.cpp:872
 #11 0x0000000101600984 in ?? ()
 #12 0x00000001016012b3 in ?? ()
 #13 0x0000000100134ccb in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:100
 #14 0x0000000100134ccb in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #15 0x0000000100134ccb in rb_vm_yield_args () at dispatcher.cpp:1278
 #16 0x00000001000db2fd in rb_vm_yield (argc=1, argv=0x7fff5fbfcc48) at
 vm.h:697
 #17 0x00000001000db2d0 in rb_yield (val=141) at vm_eval.c:183
 #18 0x000000010004d1da in int_dotimes (num=4001, sel=0x100fe7350) at
 numeric.c:3241
 #19 0x000000010012e8b4 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:159
 #20 0x000000010012e8b4 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #21 0x000000010012e8b4 in rb_vm_dispatch () at dispatcher.cpp:872
 #22 0x0000000101600984 in ?? ()
 #23 0x000000010160039d in ?? ()
 #24 0x000000010014a072 in rb_vm_run (fname=0x2000a7bc0
 "/Users/watson/tmp/t.rb", node=0x2000154a0, binding=0x0,
 inside_eval=false) at vm.cpp:4115
 #25 0x000000010002898b in ruby_run_node (n=0x2000154a0) at eval.c:211
 #26 0x0000000100000be3 in main (argc=2, argv=0x100f1c040,
 envp=0x7fff5fbfde58) at main.cpp:40
 (gdb)
 }}}

 BackTrace 2:
 {{{
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: 13 at address: 0x0000000000000000
 [Switching to process 24189 thread 0x1707]
 0x0000000101600906 in ?? ()
 (gdb) bt
 #0  0x0000000101600906 in ?? ()
 #1  0x00000001016014b3 in ?? ()
 #2  0x0000000100134ccb in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:100
 #3  0x0000000100134ccb in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #4  0x0000000100134ccb in rb_vm_yield_args () at dispatcher.cpp:1278
 #5  0x00000001000db2fd in rb_vm_yield (argc=1, argv=0x10171f928) at
 vm.h:697
 #6  0x00000001000db2d0 in rb_yield (val=49) at vm_eval.c:183
 #7  0x000000010004d1da in int_dotimes (num=4001, sel=0x100fe7350) at
 numeric.c:3241
 #8  0x000000010012e8b4 in __rb_vm_rcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:159
 #9  0x000000010012e8b4 in ruby_dispatch [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:466
 #10 0x000000010012e8b4 in rb_vm_dispatch () at dispatcher.cpp:872
 #11 0x0000000101600984 in ?? ()
 #12 0x0000000101601171 in ?? ()
 #13 0x0000000100132c67 in __rb_vm_bcall [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:98
 #14 0x0000000100132c67 in vm_block_eval [inlined] () at /Users/watson/src
 /macruby-master/dispatcher.cpp:1221
 #15 0x0000000100132c67 in rb_vm_block_eval (b=0x200015220, argc=0,
 argv=0x0) at dispatcher.cpp:1228
 #16 0x000000010014d093 in rb_vm_thread_run (thread=8590021024) at
 vm.cpp:4856
 #17 0x00007fff83cf9fd6 in _pthread_start ()
 #18 0x00007fff83cf9e89 in thread_start ()
 (gdb)
 }}}

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



More information about the macruby-tickets mailing list