[MacRuby] #871: Segfault occurs when access to variable within Blocks of Thread and Loop.

MacRuby ruby-noreply at macosforge.org
Mon Aug 23 03:15:19 PDT 2010


#871: Segfault occurs when access to variable within Blocks of Thread and Loop.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 $ cat ~/tmp/t.rb
 c1 = 0

 puts "** case 1"
 th = Thread.new {
   loop {
     1 + 1
   }
 }

 sleep 1
 th.kill

 puts "** case 2"
 th = Thread.new {
   loop {
     c1 += 1
   }
 }

 sleep 1
 }}}


 Sometimes, Segfault occurs even when set AUTO_USE_TLC=0.

 {{{
 $ AUTO_USE_TLC=0 DYLD_LIBRARY_PATH=. ./macruby -I./lib ~/tmp/t.rb
 macruby(21632) malloc: auto malloc[21632]: AUTO_USE_TLC = "0" in
 environment. Thread local collector [TLC] disabled.
 ** case 1
 ** case 2
 zsh: segmentation fault  AUTO_USE_TLC=0 DYLD_LIBRARY_PATH=. ./macruby
 -I./lib ~/tmp/t.rb
 }}}

 {{{
 $ AUTO_USE_TLC=0 DYLD_LIBRARY_PATH=. gdb --args ./macruby -I./lib
 ~/tmp/t.rb
 GNU gdb 6.3.50-20050815 (Apple version gdb-1469) (Wed May  5 04:36:56 UTC
 2010)
 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 "x86_64-apple-darwin"...Reading symbols for
 shared libraries ..... done

 (gdb) r
 Starting program: /Users/watson/src/MacRuby/macruby -I./lib
 /Users/watson/tmp/t.rb
 Reading symbols for shared libraries .++++.......................... done
 macruby(21660) malloc: auto malloc[21660]: AUTO_USE_TLC = "0" in
 environment. Thread local collector [TLC] disabled.
 Reading symbols for shared libraries . done
 ** case 1
 ** case 2

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: 13 at address: 0x0000000000000000
 [Switching to process 21660]
 0x00007fff81200052 in _cache_getMethod ()
 (gdb) bt
 #0  0x00007fff81200052 in _cache_getMethod ()
 #1  0x00007fff811ff823 in look_up_method ()
 #2  0x000000010013f272 in rb_vm_dispatch (_vm=0x103924a60,
 cache=0x103cfa7b0, top=0, self=4295275234, klass=0xfffda5e8207b8b48,
 sel=0x101572d40, block=0x0, opt=0 '\0', argc=1, argv=0x103cd2828) at
 dispatcher.cpp:602
 #3  0x0000000103b83970 in ?? ()
 #4  0x0000000103b83faf in ?? ()
 #5  0x0000000103b84181 in ?? ()
 #6  0x00000001001437a3 in rb_vm_yield_args (_vm=0x103924a60, argc=<value
 temporarily unavailable, due to optimizations>, argv=0xfffda5e8207b8b48)
 at dispatcher.cpp:98
 #7  0x00000001000fd96c in loop_i () at vm_eval.c:194
 #8  0x000000010015183a in rb_rescue2 (b_proc=<value temporarily
 unavailable, due to optimizations>, data1=<value temporarily unavailable,
 due to optimizations>, r_proc=0, data2=0) at vm.cpp:3395
 #9  0x0000000100140bc6 in rb_vm_dispatch (_vm=0x103924a60,
 cache=0x103cffc40, top=8590070432, self=8590070432, klass=0x200020f60,
 sel=0x1015cfc00, block=0x2000bf200, opt=2 '\002', argc=<value temporarily
 unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:159
 #10 0x0000000103b83970 in ?? ()
 #11 0x0000000103b840aa in ?? ()
 #12 0x0000000100142569 in rb_vm_block_eval (b=0x103924a60, argc=<value
 temporarily unavailable, due to optimizations>, argv=0x0) at
 dispatcher.cpp:98
 #13 0x00000001001568e0 in rb_vm_thread_run (thread=8590726816) at
 vm.cpp:4420
 #14 0x00007fff81563456 in _pthread_start ()
 #15 0x00007fff81563309 in thread_start ()
 (gdb)
 }}}

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



More information about the macruby-tickets mailing list