[MacRuby] #1356: Segfault occurs when invoked a Pointer.new within some threads.
#1356: Segfault occurs when invoked a Pointer.new within some threads. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Segfault occurs when invoked a Pointer.new within some threads. Test Script: {{{ #!ruby th = Thread.new { 200.times do Pointer.new('@') end } 200.times do Pointer.new('@') end th.join puts :ok }}} BackTrace: {{{ Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 0x00000001005cab0e in (anonymous namespace)::GVN::runOnFunction () at Type.h:511 511 } (gdb) t a a bt Thread 3 (process 76104): #0 0x00000001005be592 in llvm::DenseMap<(anonymous namespace)::Expression, unsigned int, llvm::DenseMapInfo<(anonymous namespace)::Expression>, llvm::DenseMapInfo<unsigned int>
::FindAndConstruct () at Type.h:511 #1 0x00000001005c3a29 in (anonymous namespace)::ValueTable::lookup_or_add () at Type.h:511 #2 0x00000001005c92de in (anonymous namespace)::GVN::processBlock () at Type.h:511 #3 0x00000001005cae66 in (anonymous namespace)::GVN::runOnFunction () at Type.h:511 #4 0x0000000100904ea0 in llvm::FPPassManager::runOnFunction () at vector.tcc:300 #5 0x000000010090503c in llvm::FunctionPassManagerImpl::run () at vector.tcc:300 #6 0x0000000100905329 in llvm::FunctionPassManager::run () at vector.tcc:300 #7 0x0000000100142379 in RoxorCore::optimize (this=0x102068200, func=0x1048001f0) at vm.cpp:554 #8 0x00000001001423f2 in RoxorCore::compile (this=0x102068200, func=0x1048001f0, run_optimize=true) at vm.cpp:591 #9 0x00000001001424f2 in RoxorCore::gen_to_ocval_convertor (this=0x102068200, type=@0x10177e320) at vm.cpp:3052 #10 0x00000001000e18dd in rb_pointer_init_type (ptr=0x200021000, type=8590069696) at bridgesupport.cpp:867 #11 0x00000001000e1a08 in rb_pointer_new (type_str=0x2000211a0 "@", val=0x200021180, len=1) at bridgesupport.cpp:879 #12 0x00000001000e1e42 in rb_pointer_s_new (rcv=8590643360, sel=0x100f22350, argc=1, argv=0x10177f388) at bridgesupport.cpp:910 #13 0x000000010012deb3 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:448 #14 0x000000010012deb3 in rb_vm_dispatch () at dispatcher.cpp:872 #15 0x00000001015006d4 in ?? () #16 0x0000000101500e4c in ?? () #17 0x0000000100134887 in __rb_vm_bcall [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:98 #18 0x0000000100134887 in vm_block_eval [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:1221 #19 0x0000000100134887 in rb_vm_yield_args () at dispatcher.cpp:1278 #20 0x00000001000daefd in rb_vm_yield (argc=1, argv=0x10177f928) at vm.h:697 #21 0x00000001000daed0 in rb_yield (val=1) at vm_eval.c:183 #22 0x000000010004cdda in int_dotimes (num=801, sel=0x100fe73e0) at numeric.c:3241 #23 0x000000010012e4b4 in __rb_vm_rcall [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:159 #24 0x000000010012e4b4 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:466 #25 0x000000010012e4b4 in rb_vm_dispatch () at dispatcher.cpp:872 #26 0x00000001015006d4 in ?? () #27 0x0000000101500c01 in ?? () #28 0x0000000100132867 in __rb_vm_bcall [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:98 #29 0x0000000100132867 in vm_block_eval [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:1221 #30 0x0000000100132867 in rb_vm_block_eval (b=0x2000a99c0, argc=0, argv=0x0) at dispatcher.cpp:1228 #31 0x000000010014cd0f in rb_vm_thread_run (thread=8590086752) at vm.cpp:4866 #32 0x00007fff83cf9fd6 in _pthread_start () #33 0x00007fff83cf9e89 in thread_start ()
Thread 2 (process 76104): #0 0x00007fff83cdaa2a in __workq_kernreturn () #1 0x00007fff83cdae3c in _pthread_wqthread () #2 0x00007fff83cdaaa5 in start_wqthread () Thread 1 (process 76104): #0 0x00000001005cab0e in (anonymous namespace)::GVN::runOnFunction () at Type.h:511 #1 0x0000000100904ea0 in llvm::FPPassManager::runOnFunction () at vector.tcc:300 #2 0x000000010090503c in llvm::FunctionPassManagerImpl::run () at vector.tcc:300 #3 0x0000000100905329 in llvm::FunctionPassManager::run () at vector.tcc:300 #4 0x0000000100142379 in RoxorCore::optimize (this=0x102068200, func=0x1011ae630) at vm.cpp:554 #5 0x00000001001423f2 in RoxorCore::compile (this=0x102068200, func=0x1011ae630, run_optimize=true) at vm.cpp:591 #6 0x00000001001424f2 in RoxorCore::gen_to_ocval_convertor (this=0x102068200, type=@0x7fff5fbfb690) at vm.cpp:3052 #7 0x00000001000e18dd in rb_pointer_init_type (ptr=0x200020dc0, type=8590069120) at bridgesupport.cpp:867 #8 0x00000001000e1a08 in rb_pointer_new (type_str=0x200020b60 "@", val=0x200020b40, len=1) at bridgesupport.cpp:879 #9 0x00000001000e1e42 in rb_pointer_s_new (rcv=8590643360, sel=0x100f22350, argc=1, argv=0x7fff5fbfc6f8) at bridgesupport.cpp:910 #10 0x000000010012deb3 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:448 #11 0x000000010012deb3 in rb_vm_dispatch () at dispatcher.cpp:872 #12 0x00000001015006d4 in ?? () #13 0x0000000101500d2c in ?? () #14 0x00000001001348cb in __rb_vm_bcall [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:100 #15 0x00000001001348cb in vm_block_eval [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:1221 #16 0x00000001001348cb in rb_vm_yield_args () at dispatcher.cpp:1278 #17 0x00000001000daefd in rb_vm_yield (argc=1, argv=0x7fff5fbfcc98) at vm.h:697 #18 0x00000001000daed0 in rb_yield (val=1) at vm_eval.c:183 #19 0x000000010004cdda in int_dotimes (num=801, sel=0x100fe73e0) at numeric.c:3241 #20 0x000000010012e4b4 in __rb_vm_rcall [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:159 #21 0x000000010012e4b4 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-master/dispatcher.cpp:466 #22 0x000000010012e4b4 in rb_vm_dispatch () at dispatcher.cpp:872 #23 0x00000001015006d4 in ?? () #24 0x0000000101500190 in ?? () #25 0x0000000100149cba in rb_vm_run (fname=0x2000a78a0 "/Users/watson/tmp/t.rb", node=0x200024ee0, binding=0x0, inside_eval=false) at vm.cpp:4125 #26 0x000000010002858b in ruby_run_node (n=0x200024ee0) at eval.c:211 #27 0x0000000100000be3 in main (argc=2, argv=0x100f1c040, envp=0x7fff5fbfde58) at main.cpp:40 (gdb) }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1356> MacRuby <http://macruby.org/>
#1356: Segfault occurs when invoked a Pointer.new within some threads. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): It looks like it needs exclusive control in RoxorCore::gen_to_ocval_convertor() {{{ #!diff diff --git a/vm.cpp b/vm.cpp index 5896ca6..a959bf0 100644 --- a/vm.cpp +++ b/vm.cpp @@ -3035,6 +3035,8 @@ RoxorCore::gen_to_rval_convertor(std::string type) void * RoxorCore::gen_to_ocval_convertor(std::string type) { + RoxorCoreLock lock; + std::map<std::string, void *>::iterator iter = to_ocval_convertors.find(type); if (iter != to_ocval_convertors.end()) { }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1356#comment:1> MacRuby <http://macruby.org/>
#1356: Segfault occurs when invoked a Pointer.new within some threads. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------+----------------------------------------- Changes (by watson1978@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: Fixed with https://github.com/MacRuby/MacRuby/commit/c01342ab56fac9d48ac8a3b5033119f070... -- Ticket URL: <http://www.macruby.org/trac/ticket/1356#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby