[MacRuby] #1225: Segfault occurs when override the @sock.shutdown in NET::IMAP.
#1225: Segfault occurs when override the @sock.shutdown in NET::IMAP. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Test Script: {{{ #!ruby require "net/imap" SERVER_ADDR = "127.0.0.1" server = TCPServer.new(SERVER_ADDR, 0) port = server.addr[1] Thread.start do ssock = server.accept ssock.print("* OK test server\r\n") end imap = Net::IMAP.new(SERVER_ADDR, port) imap.instance_eval do puts "** override shutdown" def @sock.shutdown(*how) end end puts "** done" }}} {{{ $ ruby19 t.rb ** override shutdown ** done $ macruby t.rb ** override shutdown zsh: segmentation fault macruby t.rb }}} BackTrace: {{{ Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018 [Switching to process 1051 thread 0x2b0b] 0x0000000100892790 in llvm::Calculate<llvm::Function, llvm::BasicBlock*> () (gdb) bt #0 0x0000000100892790 in llvm::Calculate<llvm::Function, llvm::BasicBlock*> () #1 0x0000000100894201 in llvm::DominatorTreeBase<llvm::BasicBlock>::recalculate<llvm::Function> () #2 0x000000010088f08d in llvm::DominatorTree::runOnFunction () #3 0x0000000100901aa0 in llvm::FPPassManager::runOnFunction () #4 0x0000000100901c3c in llvm::FunctionPassManagerImpl::run () #5 0x0000000100901f29 in llvm::FunctionPassManager::run () #6 0x000000010013f89d in RoxorCore::optimize (this=0x102068200, func=0x10151f540) at vm.cpp:543 #7 0x000000010013f916 in RoxorCore::compile (this=0x102068200, func=0x10151f540, run_optimize=true) at vm.cpp:577 #8 0x0000000100143268 in RoxorCore::resolve_method (this=0x102068200, klass=0x200220bc0, sel=0x101503310, func=0x10151f540, arity=@0x10490ee48, flags=2, imp=0, m=0x0, objc_imp_types=0x0) at vm.cpp:1867 #9 0x000000010014366d in RoxorCore::resolve_methods (this=0x102068200, map=0x1011bc210, klass=0x200220bc0, sel=0x101503310) at vm.cpp:1946 #10 0x000000010014484f in rb_vm_resolve_method (klass=0x200220bc0, sel=0x101503310) at vm.cpp:2006 #11 0x00000001001448ad in resolveInstanceMethod_imp (self=0x2000f50a0, sel=0x7fff819d0585, name=0x101503310) at vm.cpp:4920 #12 0x00007fff86969937 in _class_resolveMethod () #13 0x000000010012b02e in rb_vm_dispatch () at dispatcher.cpp:635 #14 0x0000000101600d74 in ?? () #15 0x00000001016033a2 in ?? () #16 0x000000010012c444 in __rb_vm_rcall [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:159 #17 0x000000010012c444 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:466 #18 0x000000010012c444 in rb_vm_dispatch () at dispatcher.cpp:863 #19 0x0000000101600d74 in ?? () #20 0x0000000101602aa0 in ?? () #21 0x000000010012c444 in __rb_vm_rcall [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:159 #22 0x000000010012c444 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:466 #23 0x000000010012c444 in rb_vm_dispatch () at dispatcher.cpp:863 #24 0x000000010129ba55 in md5 () #25 0x00000001012adca6 in MREP_97B206DE041042B78F82683BD0596131 () #26 0x000000010012c444 in __rb_vm_rcall [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:159 #27 0x000000010012c444 in ruby_dispatch [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:466 #28 0x000000010012c444 in rb_vm_dispatch () at dispatcher.cpp:863 #29 0x000000010129ba55 in md5 () #30 0x00000001012ad90c in MREP_97B206DE041042B78F82683BD0596131 () #31 0x00000001001307f3 in __rb_vm_bcall [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:98 #32 0x00000001001307f3 in vm_block_eval [inlined] () at /Users/watson/src /macruby-trunk/dispatcher.cpp:1212 #33 0x00000001001307f3 in rb_vm_block_eval (b=0x20020d600, argc=0, argv=0x0) at dispatcher.cpp:1219 #34 0x0000000100149985 in rb_vm_thread_run (thread=8590747520) at vm.cpp:4577 #35 0x00007fff85d534f6 in _pthread_start () #36 0x00007fff85d533a9 in thread_start () }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1225> MacRuby <http://macruby.org/>
#1225: Segfault occurs when override the @sock.shutdown in NET::IMAP. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Apparently a race condition when calling LLVM: {{{ (gdb) thread apply all bt Thread 5 (process 2780): #0 0x00000001004eef1a in llvm::InstCombiner::DoOneIteration () #1 0x00000001004ead3b in llvm::InstCombiner::runOnFunction () #2 0x0000000100642b08 in llvm::FPPassManager::runOnFunction () #3 0x0000000100643cea in llvm::FunctionPassManagerImpl::run () #4 0x0000000100643e1b in llvm::FunctionPassManager::run () #5 0x0000000100144640 in RoxorCore::optimize () at /Users/lrz/src /macruby-master/vm.cpp:543 #6 0x0000000100144640 in RoxorCore::compile (this=0x10101bc00, func=0x102c022b0, run_optimize=<value temporarily unavailable, due to optimizations>) at vm.cpp:577 #7 0x000000010014eda1 in RoxorCore::resolve_method (this=0x10101bc00, klass=0x400314e20, sel=0x1028dfb70, func=0x102c022b0, arity=@0x102d43828, flags=2, imp=0, m=0x0, objc_imp_types=0x0) at vm.cpp:1867 #8 0x000000010014ef5c in RoxorCore::resolve_methods (this=0x10101bc00, map=0x100bbf410, klass=0x400314e20, sel=0x1028dfb70) at vm.cpp:1946 #9 0x00000001001555ac in rb_vm_resolve_method (klass=0x400314e20, sel=0x1028dfb70) at vm.cpp:2006 #10 0x000000010015565c in resolveInstanceMethod_imp (self=<value temporarily unavailable, due to optimizations>, sel=<value temporarily unavailable, due to optimizations>, name=<value temporarily unavailable, due to optimizations>) at vm.cpp:4920 #11 0x00007fff851736e1 in _class_resolveMethod () #12 0x000000010013cba0 in rb_vm_dispatch (_vm=0x102d4cb20, cache=0x102bb3240, top=17187292448, self=17187292448, klass=0x400317040, sel=0x1028dfb70, block=0x0, opt=1 '\001', argc=0, argv=0x0) at dispatcher.cpp:635 #13 0x0000000102b00d6c in ?? () #14 0x0000000102b033dd in ?? () #15 0x000000010013e6ac in rb_vm_dispatch (_vm=0x102d4cb20, cache=0x102bbc540, top=17187292448, self=17187292448, klass=0x400317040, sel=0x1028f3610, block=0x0, opt=1 '\001', argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:159 #16 0x0000000102b00d6c in ?? () #17 0x0000000102b02ad3 in ?? () #18 0x000000010013e6ac in rb_vm_dispatch (_vm=0x102d4cb20, cache=0x102ba9290, top=17187292448, self=17187292448, klass=0x400317040, sel=0x7fff86892c96, block=0x40071f3e0, opt=2 '\002', argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:159 #19 0x0000000100f8a1a1 in dyld_stub_rb_define_module () #20 0x0000000100f9c237 in MREP_6211DECCE62B4C3B8D629CABF02EA283 () #21 0x000000010013e6ac in rb_vm_dispatch (_vm=0x102d4cb20, cache=0x102ba4440, top=17187292448, self=17187292448, klass=0x400317040, sel=0x100bbff30, block=0x0, opt=1 '\001', argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:159 #22 0x0000000100f8a1a1 in dyld_stub_rb_define_module () #23 0x0000000100f9be5f in MREP_6211DECCE62B4C3B8D629CABF02EA283 () #24 0x000000010013fdc9 in rb_vm_block_eval (b=0x102d4cb20, argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:98 #25 0x0000000100153f28 in rb_vm_thread_run (thread=17187334816) at vm.cpp:4577 #26 0x00007fff8bf0b5b2 in _pthread_start () #27 0x00007fff8bf0e339 in thread_start () Thread 4 (process 2780): #0 0x00007fff8435d162 in __workq_kernreturn () #1 0x00007fff8bf0d287 in _pthread_wqthread () #2 0x00007fff8bf0e349 in start_wqthread () Thread 3 (process 2780): #0 0x00007fff8435d7b6 in kevent () #1 0x00007fff8196b872 in _dispatch_mgr_invoke () #2 0x00007fff8196a40a in _dispatch_mgr_thread () Thread 2 (process 2780): #0 0x00007fff8435d162 in __workq_kernreturn () #1 0x00007fff8bf0d287 in _pthread_wqthread () #2 0x00007fff8bf0e349 in start_wqthread () Thread 1 (process 2780): #0 0x00000001001ceaf0 in (anonymous namespace)::X86DAGToDAGISel::Select () #1 0x00000001003398f2 in llvm::SelectionDAGISel::DoInstructionSelection () #2 0x000000010033ae61 in llvm::SelectionDAGISel::CodeGenAndEmitDAG () #3 0x000000010033c12e in llvm::SelectionDAGISel::SelectBasicBlock () #4 0x000000010033c3d6 in llvm::SelectionDAGISel::SelectAllBasicBlocks () #5 0x000000010033c7a0 in llvm::SelectionDAGISel::runOnMachineFunction () #6 0x00000001003b0501 in llvm::MachineFunctionPass::runOnFunction () #7 0x0000000100642b08 in llvm::FPPassManager::runOnFunction () #8 0x0000000100643cea in llvm::FunctionPassManagerImpl::run () #9 0x0000000100643e1b in llvm::FunctionPassManager::run () #10 0x000000010035464d in llvm::JIT::getPointerToFunction () #11 0x00000001001445a2 in RoxorCore::compile (this=0x10101bc00, func=0x1028b6800, run_optimize=<value temporarily unavailable, due to optimizations>) at vm.cpp:581 #12 0x000000010014ece6 in RoxorCore::resolve_method (this=0x10101bc00, klass=0x400316fc0, sel=0x100bb5ac0, func=0x100bb9ad0, arity=@0x7fff5fbfe328, flags=1, imp=0x102b0a400, m=0x100be5148, objc_imp_types=0x0) at vm.cpp:1903 #13 0x0000000100155ac9 in prepare_method (klass=0x400316fc0, dynamic_class=<value temporarily unavailable, due to optimizations>, sel=0x100bb5ac0, data=0x100bb9ad0, arity=@0x7fff5fbfe328, flags=1, precompiled=false, objc_imp_types=0x0) at vm.cpp:2125 #14 0x0000000100156190 in rb_vm_prepare_method (klass=<value temporarily unavailable, due to optimizations>, dynamic_class=<value temporarily unavailable, due to optimizations>, sel=<value temporarily unavailable, due to optimizations>, func=<value temporarily unavailable, due to optimizations>, arity=<value temporarily unavailable, due to optimizations>, flags=<value temporarily unavailable, due to optimizations>) at vm.cpp:2201 #15 0x0000000102b0a370 in ?? () #16 0x000000010013f12d in rb_vm_yield_under (klass=<value temporarily unavailable, due to optimizations>, self=17187292448, argc=<value temporarily unavailable, due to optimizations>, argv=0x0) at dispatcher.cpp:98 #17 0x00000001000f5bef in specific_eval (argc=<value temporarily unavailable, due to optimizations>, argv=0x0, klass=17183109184, self=17187292448) at vm_eval.c:353 #18 0x000000010013e1df in rb_vm_dispatch (_vm=0x100b3b1e0, cache=0x100a96560, top=17184153504, self=17187292448, klass=0x400314ea0, sel=0x100b69920, block=0x40071b420, opt=0 '\0', argc=0, argv=0x0) at dispatcher.cpp:457 #19 0x0000000102b00d6c in ?? () #20 0x0000000102b003f5 in ?? () #21 0x0000000100154fa3 in rb_vm_run (fname=<value temporarily unavailable, due to optimizations>, node=0x4004a4e00, binding=<value temporarily unavailable, due to optimizations>, inside_eval=false) at vm.cpp:3962 warning: .o file "/Users/lrz/src/macruby-master/.objs/eval.o" more recent than executable timestamp in "/Users/lrz/src/macruby- master/libmacruby.1.9.2.dylib" warning: Couldn't open object file '/Users/lrz/src/macruby- master/.objs/eval.o' #22 0x0000000100031050 in ruby_run_node () #23 0x0000000100000cf8 in main (argc=2, argv=0x10280f810, envp=<value temporarily unavailable, due to optimizations>) at main.cpp:40 }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1225#comment:1> MacRuby <http://macruby.org/>
#1225: Segfault occurs when override the @sock.shutdown in NET::IMAP. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: minor | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: fixed Keywords: | ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: => MacRuby 0.11 Comment: Should be fixed by https://github.com/MacRuby/MacRuby/commit/088786aa7c692ccd03942d30ca321f44f0... -- Ticket URL: <http://www.macruby.org/trac/ticket/1225#comment:2> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby