Bug #3100


Lockup in child after fork

Added by alk (Aliaksey Kandratsenka) almost 13 years ago. Updated over 3 years ago.

ruby -v:
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]


I was using PTY.spawn and found a bug. I'm attaching a small testcase that at least on 2 my machines gives quite probable ruby process lockup in child.

I'm also attaching gdb backtrace of locked up child. It can be seen that we're stuck in NTPL's low-level lock that protects timer thread condition variable. So it looks like I'm doing fork at 'right' time, when this condition is being signaled in parent.

P.S. I'm categorizing it as core even though I can reproduce this only via PTY.spawn, 'cause pty.c looks very much innocent.


forktest.rb (548 Bytes) forktest.rb alk (Aliaksey Kandratsenka), 04/05/2010 08:14 PM
backtrace.txt (7.8 KB) backtrace.txt alk (Aliaksey Kandratsenka), 04/05/2010 08:14 PM
strace.log (36.1 KB) strace.log $ strace ruby forktest.rb 1 vo.x (Vit Ondruch), 08/30/2011 05:09 PM

Related issues 1 (0 open1 closed)

Related to Backport187 - Backport #2739: ruby 1.8.7 built with pthreads hangs under some circumstancesClosedshyouhei (Shyouhei Urabe)02/12/2010Actions
Actions #1

Updated by naruse (Yui NARUSE) almost 13 years ago

Try ruby_1_8 branch and see the thread [ruby-core:28151].

Actions #2

Updated by alk (Aliaksey Kandratsenka) almost 13 years ago

ruby_1_8_7@27173 and ruby_1_8@27224 still hang.

with 1.8.7 branch the backtrace is a bit different

(gdb) bt
#0 0xffffe430 in __kernel_vsyscall ()
#1 0xf76d3b69 in __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:142
#2 0xf76d16f6 in pthread_cond_signal@@GLIBC_2.3.2 ()
at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_signal.S:174
#3 0xf7728e6d in rb_thread_stop_timer () at eval.c:12357
#4 0xf75b38b6 in __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:170
#5 0xf76d66f4 in __fork () at ../nptl/sysdeps/unix/sysv/linux/pt-fork.c:26
#6 0xf76f84d9 in establishShell (argc=1, argv=0xff9c80e0, self=4149235120) at pty.c:226


Actions #3

Updated by kosaki (Motohiro KOSAKI) over 12 years ago

Unfortunatelly, I don't reproduce this problem on current ruby_1_8 branch. ruby_1_8_7 branch result is expected, you saw #2739 issue.

Actions #4

Updated by alk (Aliaksey Kandratsenka) over 12 years ago

Pass --enable-pthread to ./configure. That's part of ruby configuration in Debian/Ubuntu.

Latest as of Sat May 8 14:39:23 UTC 2010 ruby_1_8 still hangs.


Updated by vo.x (Vit Ondruch) over 11 years ago

May I ask what is the state of this issue? The reproducer was recently mentioned as an issue in upcoming RHEL 6.2 [1] and it lockups on my Fedora with ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]. I am


Updated by vo.x (Vit Ondruch) about 11 years ago

Please can somebody take a look into this issue? Ruby 1.8.7-p352 are unfortunately still affected by this bug.

Actions #7

Updated by jeremyevans0 (Jeremy Evans) over 3 years ago

  • Description updated (diff)
  • Status changed from Open to Closed

Also available in: Atom PDF