spec "Process.fork - return nil for child process" is hanging #7

Closed
dgtized opened this Issue May 26, 2009 · 1 comment

Projects

None yet

2 participants

@dgtized
Member
dgtized commented May 26, 2009

After a clean build from rake, the normal ci spec run hangs at the above spec. While it is hung, if I do a ps -a | grep rbx, there are 3 entries, one of which is marked . Using gdb to connect to one of the pid's shows a backtrace like so:


(gdb) bt
#0  0xb80b5430 in __kernel_vsyscall ()
#1  0xb7e762cb in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2  0x081085f9 in rubinius::System::vm_wait_pid (state=0x98630e8, pid_obj=0xebc7, no_hang=0xa) at vm/builtin/system.cpp:122
#3  0x080c1a41 in rubinius::Primitives::vm_wait_pid (state=0x98630e8, call_frame=0xbf8c9948, msg=@0x9a33c40, args=@0xbf8c97c8) at vm/gen/primitives_glue.gen.cpp:14264
#4  0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x9a33840, call_frame=0xbf8c9948, args=@0xbf8c9bc8) at vm/gen/instructions.cpp:759
#5  0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x9a33840, call_frame=0xbf8c9948, args=@0xbf8c9bc8) at vm/vmmethod.cpp:661
#6  0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c9ce4, msg=@0xad74d70, args=@0xbf8c9bc8) at vm/vmmethod.cpp:481
#7  0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xad74b78, call_frame=0xbf8c9ce4, args=@0xbf8c9fc8) at vm/gen/instructions.cpp:759
#8  0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xad74b78, call_frame=0xbf8c9ce4, args=@0xbf8c9fc8) at vm/vmmethod.cpp:661
#9  0x0811338e in rubinius::BlockEnvironment::execute_interpreter (state=0x98630e8, previous=0xbf8ca178, env=0xb7831738, args=@0xbf8c9fc8, invocation=@0xbf8c9e90) at vm/builtin/block_environment.cpp:87
#10 0x0811305c in rubinius::BlockEnvironment::call_under (this=0xb7831738, state=0x98630e8, exec=0xb765f330, call_frame=0xbf8ca178, msg=@0x999dac8, args=@0xbf8c9fc8) at vm/builtin/block_environment.cpp:141
#11 0x080d54dc in rubinius::Primitives::block_call_under (state=0x98630e8, call_frame=0xbf8ca178, msg=@0xbf8c9648, args=@0xbf8c9fc8) at vm/gen/primitives_glue.gen.cpp:2016
#12 0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x999d2d0, call_frame=0xbf8ca178, args=@0xbf8ca3f8) at vm/gen/instructions.cpp:759
#13 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x999d2d0, call_frame=0xbf8ca178, args=@0xbf8ca3f8) at vm/vmmethod.cpp:661
#14 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8ca534, msg=@0xa05c6f8, args=@0xbf8ca3f8) at vm/vmmethod.cpp:481
#15 0x0815b504 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05c360, call_frame=0xbf8ca534, args=@0xbf8ca7a8) at vm/gen/instructions.cpp:786
#16 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05c360, call_frame=0xbf8ca534, args=@0xbf8ca7a8) at vm/vmmethod.cpp:661
#17 0x080909bb in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8ca8c4, msg=@0xa05dbc0, args=@0xbf8ca7a8) at vm/vmmethod.cpp:481
#18 0x0815b504 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05dad0, call_frame=0xbf8ca8c4, args=@0xbf8cab68) at vm/gen/instructions.cpp:786
#19 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05dad0, call_frame=0xbf8ca8c4, args=@0xbf8cab68) at vm/vmmethod.cpp:661
#20 0x0811338e in rubinius::BlockEnvironment::execute_interpreter (state=0x98630e8, previous=0xbf8cac74, env=0xb7835c94, args=@0xbf8cab68, invocation=@0xbf8caa68) at vm/builtin/block_environment.cpp:87
#21 0x08112eb4 in rubinius::BlockEnvironment::call (this=0xb7835c94, state=0x98630e8, call_frame=0xbf8cac74, args=@0xbf8cab68, flags=0) at vm/builtin/block_environment.cpp:100
#22 0x08164d72 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05dbe0, call_frame=0xbf8cac74, args=@0xbf8caf18) at vm/gen/instructions.cpp:970
#23 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05dbe0, call_frame=0xbf8cac74, args=@0xbf8caf18) at vm/vmmethod.cpp:661
#24 0x0811338e in rubinius::BlockEnvironment::execute_interpreter (state=0x98630e8, previous=0xbf8cb024, env=0xb7835ce4, args=@0xbf8caf18, invocation=@0xbf8cae18) at vm/builtin/block_environment.cpp:87
#25 0x08112eb4 in rubinius::BlockEnvironment::call (this=0xb7835ce4, state=0x98630e8, call_frame=0xbf8cb024, args=@0xbf8caf18, flags=0) at vm/builtin/block_environment.cpp:100
... etc

connecting to the other (non defunkt) process gives the following backtrace:


(gdb) bt
#0  0xb80b5430 in __kernel_vsyscall () 
#1  0xb7dc9cf9 in __lll_lock_wait () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb7dc5138 in _L_lock_289 () from /lib/tls/i686/cmov/libpthread.so.0
#3  0xb7dc4b76 in pthread_mutex_lock () from /lib/tls/i686/cmov/libpthread.so.0
#4  0xb7eca4b6 in pthread_mutex_lock () from /lib/tls/i686/cmov/libc.so.6
#5  0x0808dab1 in thread::Mutex::lock (this=0x98626f0) at vm/util/thread.hpp:298
#6  0x0810f5fb in rubinius::NativeFunction::call (this=0xb74643b0, state=0x98630e8, args=@0xbf8c8838) at vm/builtin/nativefunction.cpp:512
#7  0x0810f7fb in rubinius::NativeFunction::execute (state=0x98630e8, call_frame=0xbf8c89b8, msg=@0x99a67f8, args=@0xbf8c8838) at vm/builtin/nativefunction.cpp:56
#8  0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x99a6258, call_frame=0xbf8c89b8, args=@0xbf8c8c38) at vm/gen/instructions.cpp:759
#9  0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x99a6258, call_frame=0xbf8c89b8, args=@0xbf8c8c38) at vm/vmmethod.cpp:661
#10 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c8d98, msg=@0x99a6c20, args=@0xbf8c8c38) at vm/vmmethod.cpp:481
#11 0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x99a6a98, call_frame=0xbf8c8d98, args=@0xbf8c9018) at vm/gen/instructions.cpp:759
#12 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x99a6a98, call_frame=0xbf8c8d98, args=@0xbf8c9018) at vm/vmmethod.cpp:661
#13 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c9198, msg=@0x99b3010, args=@0xbf8c9018) at vm/vmmethod.cpp:481
#14 0x0815bb74 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x99b2d48, call_frame=0xbf8c9198, args=@0xbf8c9418) at vm/gen/instructions.cpp:851
#15 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x99b2d48, call_frame=0xbf8c9198, args=@0xbf8c9418) at vm/vmmethod.cpp:661
#16 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c9554, msg=@0x9896008, args=@0xbf8c9418) at vm/vmmethod.cpp:481
#17 0x0815aeda in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x9895f38, call_frame=0xbf8c9554, args=@0xbf8c97c8) at vm/gen/instructions.cpp:823
#18 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x9895f38, call_frame=0xbf8c9554, args=@0xbf8c97c8) at vm/vmmethod.cpp:661
#19 0x08091431 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c9948, msg=@0x99b2c68, args=@0xbf8c97c8) at vm/vmmethod.cpp:481
#20 0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x99b2900, call_frame=0xbf8c9948, args=@0xbf8c9bc8) at vm/gen/instructions.cpp:759
#21 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x99b2900, call_frame=0xbf8c9948, args=@0xbf8c9bc8) at vm/vmmethod.cpp:661
#22 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8c9ce4, msg=@0xad74d30, args=@0xbf8c9bc8) at vm/vmmethod.cpp:481
#23 0x0815b504 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xad74b78, call_frame=0xbf8c9ce4, args=@0xbf8c9fc8) at vm/gen/instructions.cpp:786
#24 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xad74b78, call_frame=0xbf8c9ce4, args=@0xbf8c9fc8) at vm/vmmethod.cpp:661
#25 0x0811338e in rubinius::BlockEnvironment::execute_interpreter (state=0x98630e8, previous=0xbf8ca178, env=0xb7831738, args=@0xbf8c9fc8, invocation=@0xbf8c9e90) at vm/builtin/block_environment.cpp:87
#26 0x0811305c in rubinius::BlockEnvironment::call_under (this=0xb7831738, state=0x98630e8, exec=0xb765f330, call_frame=0xbf8ca178, msg=@0x999dac8, args=@0xbf8c9fc8) at vm/builtin/block_environment.cpp:141
#27 0x080d54dc in rubinius::Primitives::block_call_under (state=0x98630e8, call_frame=0xbf8ca178, msg=@0x80, args=@0xbf8c9fc8) at vm/gen/primitives_glue.gen.cpp:2016
#28 0x0815b414 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0x999d2d0, call_frame=0xbf8ca178, args=@0xbf8ca3f8) at vm/gen/instructions.cpp:759
#29 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0x999d2d0, call_frame=0xbf8ca178, args=@0xbf8ca3f8) at vm/vmmethod.cpp:661
#30 0x080910e1 in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8ca534, msg=@0xa05c6f8, args=@0xbf8ca3f8) at vm/vmmethod.cpp:481
#31 0x0815b504 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05c360, call_frame=0xbf8ca534, args=@0xbf8ca7a8) at vm/gen/instructions.cpp:786
#32 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05c360, call_frame=0xbf8ca534, args=@0xbf8ca7a8) at vm/vmmethod.cpp:661
#33 0x080909bb in rubinius::VMMethod::execute_specialized (state=0x98630e8, previous=0xbf8ca8c4, msg=@0xa05dbc0, args=@0xbf8ca7a8) at vm/vmmethod.cpp:481
#34 0x0815b504 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05dad0, call_frame=0xbf8ca8c4, args=@0xbf8cab68) at vm/gen/instructions.cpp:786
#35 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05dad0, call_frame=0xbf8ca8c4, args=@0xbf8cab68) at vm/vmmethod.cpp:661
#36 0x0811338e in rubinius::BlockEnvironment::execute_interpreter (state=0x98630e8, previous=0xbf8cac74, env=0xb7835c94, args=@0xbf8cab68, invocation=@0xbf8caa68) at vm/builtin/block_environment.cpp:87
#37 0x08112eb4 in rubinius::BlockEnvironment::call (this=0xb7835c94, state=0x98630e8, call_frame=0xbf8cac74, args=@0xbf8cab68, flags=0) at vm/builtin/block_environment.cpp:100
#38 0x08164d72 in rubinius::VMMethod::interpreter (state=0x98630e8, vmm=0xa05dbe0, call_frame=0xbf8cac74, args=@0xbf8caf18) at vm/gen/instructions.cpp:970
#39 0x0808ec78 in rubinius::VMMethod::run_interpreter (state=0x98630e8, vmm=0xa05dbe0, call_frame=0xbf8cac74, args=@0xbf8caf18) at vm/vmmethod.cpp:661
... etc

Currently this is always reproducable on my Ubuntu 32bit 9.04, gcc 4.3.3 box.

@evanphx
Member
evanphx commented May 26, 2009

Fixed in 5562ec6

@dbussink dbussink added a commit that referenced this issue Jul 8, 2013
@dbussink dbussink Guard memory allocations for JIT memory with spinlock
This fixes a crash issue where the JIT was running independent from the
GC and the GC was deallocating JIT memory at the same time. We don't
want to make the whole JIT generation GC dependent, since that causes
performance issues, so we guard all memory allocations here with a
spinlock.

The crash would be exposed with these backtraces where things were
modified concurrently:

Thread 6 (process 70553):
 #0  rubinius::jit::FreeRangeHeader::AddToFreeList () at /Users/dirkjan/Code/rubinius/vm/llvm/jit_memory_manager.hpp:151
 #1  0x000000010989f037 in rubinius::jit::MemoryRangeHeader::TrimAllocationToSize (this=0x10f7ec688, FreeList=0x10f7ec688, NewSize=5064) at vm/llvm/jit_memory_manager.cpp:211
 #2  0x000000010989bb75 in rubinius::jit::RubiniusRequestJITMemoryManager::endFunctionBody (this=<value temporarily unavailable, due to optimizations>, F=<value temporarily unavailable, due to optimizations>, FunctionStart=<value temporarily unavailable, due to optimizations>, FunctionEnd=0x13c8 <Address 0x13c8 out of bounds>) at jit_memory_manager.hpp:317
 #3  0x0000000109b4f852 in (anonymous namespace)::JITEmitter::finishFunction ()
 #4  0x0000000109946106 in (anonymous namespace)::Emitter<llvm::JITCodeEmitter>::runOnMachineFunction ()
 #5  0x0000000109bbbc30 in llvm::MachineFunctionPass::runOnFunction ()
 #6  0x0000000109f1beb2 in llvm::FPPassManager::runOnFunction ()
 #7  0x0000000109f1b9f9 in llvm::FunctionPassManagerImpl::run ()
 #8  0x0000000109f1b8a1 in llvm::FunctionPassManager::run ()
 #9  0x0000000109b461ab in llvm::JIT::runJITOnFunctionUnlocked ()
 #10 0x0000000109b46148 in llvm::JIT::runJITOnFunction ()
 #11 0x0000000109898fcc in rubinius::jit::Compiler::generate_function (this=0x10d485d38, indy=true) at vm/llvm/jit_compiler.cpp:118
 #12 0x00000001098ada93 in rubinius::BackgroundCompilerThread::perform (this=0x7fce81633240) at vm/llvm/state.cpp:345
 #13 0x00000001098ad4ef in rubinius::utilities::thread::Thread::delete_on_exit () at /Users/dirkjan/Code/rubinius/vm/util/thread.hpp:79
 #14 0x00000001098ad4ef in rubinius::utilities::thread::Thread::trampoline (arg=0x7fce81633240) at thread.hpp:211
 #15 0x00007fff8e73c7a2 in _pthread_start ()
 #16 0x00007fff8e7291e1 in thread_start ()

Thread 5 (process 70553):
 #0  0x00007fff952b5386 in __semwait_signal ()
 #1  0x00007fff8e7c6800 in nanosleep ()
 #2  0x00007fff8e7c668a in sleep ()
 #3  0x000000010969c9dd in rubinius::segv_handler (sig=11) at vm/environment.cpp:211
 #4  <signal handler called>
 #5  rubinius::jit::FreeRangeHeader::AddToFreeList () at /Users/dirkjan/Code/rubinius/vm/llvm/jit_memory_manager.hpp:151
 #6  0x000000010989ee53 in rubinius::jit::MemoryRangeHeader::FreeBlock (this=0x10f7c88f0, FreeList=<value temporarily unavailable, due to optimizations>) at jit_memory_manager.hpp:155
 #7  0x00000001098ac3e7 in rubinius::LLVMState::remove (this=<value temporarily unavailable, due to optimizations>, func=<value temporarily unavailable, due to optimizations>) at jit_memory_manager.hpp:426
 #8  0x000000010983dde9 in rubinius::CodeManager::sweep (this=0x7fce8180a2d8) at vm/gc/code_manager.cpp:107
 #9  0x0000000109750e7e in rubinius::ObjectMemory::mark () at /Users/dirkjan/Code/rubinius/vm/objectmemory.hpp:634
 #10 0x0000000109750e7e in rubinius::ObjectMemory::collect_mature_finish (this=0x7fce8180a200, state=0x10c94fec8, data=0x7fce8528b220) at vm/objectmemory.cpp:636
 #11 0x0000000109843d8a in rubinius::State::memory () at /Users/dirkjan/Code/rubinius/vm/state.hpp:171
 #12 0x0000000109843d8a in rubinius::ImmixMarker::perform (this=0x7fce8163a720, state=0x10c94fec8) at vm/gc/immix_marker.cpp:172
 #13 0x0000000109843b71 in rubinius::immix_marker_tramp (state=0x10f7ec688) at vm/gc/immix_marker.cpp:18
 #14 0x00000001098094c0 in rubinius::Thread::in_new_thread (ptr=0x7fce86a23e70) at vm/builtin/thread.cpp:250
 #15 0x00007fff8e73c7a2 in _pthread_start ()
 #16 0x00007fff8e7291e1 in thread_start ()
1bde000
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment