[Bug #1872] [ruby_1_8] Kernel#system doesn't work in forked process

Bug #1872: [ruby_1_8] Kernel#system doesn’t work in forked process
http://redmine.ruby-lang.org/issues/show/1872

e$B5/I<<Te(B: Hidetoshi Nagai
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: High
e$B%+%F%4%je(B: core, Target version: Ruby 1.8.8
ruby -v: ruby 1.8.8dev (2009-08-03 revision 24370) [i686-linux]

OS e$B4D6-$K0MB8$7$F$$$k5$$b$7$J$$$G$O$J$$$G$9$,!$e(B
e$BNc$($P<!$N$h$&$JNc$,e(B hang-up e$B$7$^$9!%e(B

$ ruby -e ‘Process.fork{p system(“ls”)}’

Linux 2.6.15, glibc 2.3.3 e$B$K$$1$ke(B
ruby 1.8.8dev (2009-08-03 revision 24370) e$B$G$9!%e(B
configure e$B%
%W%7%g%s$Oe(B --enable-pthread [email protected]$1$rM?$($F$$$^$9!%e(B

rb_f_system() e$BCf$Ne(B fork e$B$^$G$O40N;$7$F$*$j!$e(B
e$B;R%W%m%;%[email protected]@.$5$l$F$O$$$k$b$N$N!$e(B
[email protected]@.D>8e$K8G$^$C$F$7$^$C$F$$$k$h$&$G$9!%e(B
e$B?F%W%m%;%9$K$D$$$F$O!$;R%W%m%;%9$Ne(B ID e$B$r<u$1<h$j!$e(B
e$BAGD>$KF0:n$7$Fe(B rb_syswait()
e$B$KF~$C$F$$$k$h$&$K8+<u$1$i$l$^$9!%e(B

e$B$J$*!$>e5-$NNc$Ge(B system e$B$NBe$j$Ke(B exec e$B$H$7$?>l9g$K$Oe(B
e$BLdBj$J$/F0:n$7$^$9!%e(B

e$B%A%1%C%He(B #1872 e$B$,99?7$5$l$^$7$?!#e(B (by Kazuhiko Shiozaki)

Mandriva 2009.1
(glibc-2.9-0.20081113.5.1mnb2)e$B$G$O:F8=$7$^$;$s$G$7$?$,!"e(B
Debian Ecth (libc6 2.3.6.ds1-13etch9) e$B$N4D6-$G:F8=$7$^$7$?!#e(B
e$B%j%S%8%g%s$rAL$C$F$$$/$H!"e(B r23268
e$B0J9_!“H/@8$9$k!J$3$H$,$”$k!K$h$&$G$9!#e(B

* eval.c (rb_thread_start_timer): guard condition was inverted. 

[ruby-dev:38319]


http://redmine.ruby-lang.org/issues/show/1872

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:39039] [Bug #1872] [ruby_1_8] Kernel#system
doesn’t work in forked process”
on Aug.07,2009 20:09:44, [email protected] wrote:

Mandriva 2009.1 (glibc-2.9-0.20081113.5.1mnb2)e$B$G$O:F8=$7$^$;$s$G$7$?$,!"e(B
Debian Ecth (libc6 2.3.6.ds1-13etch9) e$B$N4D6-$G:F8=$7$^$7$?!#e(B
e$B%j%S%8%g%s$rAL$C$F$$$/$H!"e(B r23268 e$B0J9_!“H/@8$9$k!J$3$H$,$”$k!K$h$&$G$9!#e(B

* eval.c (rb_thread_start_timer): guard condition was inverted. [ruby-dev:38319]

r23268e$B<[email protected][email protected]$J$N$G!"MW$9$k$K3:[email protected]$He(Btimer thread
e$B$,$$$k;~$Ke(Bforke$B$9$k$H$^$:$$$H$$$&$3$H$J$N$G$7$g$&!#e(B

POSIX threade$B$O$h$/$o$+$i$J$$$N$G$9$,!"$D$i$D$i9M$($F$$?$H$3e(B
e$B$m!"e(Bforke$BA0$Ke(Btimer
threade$B$r;
$a$F!“e(Bforke$B8e$K?F;RAPJ}$G$^$?e(Btimer
threade$B$rF0$+$;$P$$$$$s$8$c$J$$$+$H$$$&5$$,$7$F$-$^$7$?!#e(B
e$B<j85$K$O4D6-$,$J$$$N$G$+$:$R$3$5$s$K0J2<$N%Q%C%A$r;n$7$F$b$ie(B
e$B$C$?$H$3$m!”$$$A$*$&F0$/$h$&$K$J$k$_$?$$$G$9!#e(B

e$B$o$+$k?M$d85$N%3!<%I$r=q$$$??Me(B([email protected]$5$s$+$Je(B?)e$B$KH/A[$,@5$7$$e(B
e$B$+9M$($F$[$7$$$N$G$9$,!"$I$s$J$b$s$G$7$g$&$+e(B…

Index: eval.c

— eval.c (revision 24389)
+++ eval.c (working copy)
@@ -12485,7 +12485,7 @@ rb_thread_start_timer()
safe_mutex_lock(&time_thread.lock);
if (pthread_create(&time_thread.thread, 0, thread_timer, args) ==
0) {
thread_init = 1;

  • pthread_atfork(0, 0, rb_thread_stop_timer);
  • pthread_atfork(rb_thread_stop_timer, rb_thread_start_timer,
    rb_thread_start_timer);
    pthread_cond_wait(&start, &time_thread.lock);
    }
    pthread_cleanup_pop(1);

e$B$=$l$G$O!#e(B

e$B1J0fe([email protected]$BCNG=!%6e9)Bg$G$9!%e(B

From: “U.Nakamura” [email protected]
Subject: [ruby-dev:39040] Re: [Bug #1872] [ruby_1_8] Kernel#system
doesn’t work in forked process
Date: Fri, 7 Aug 2009 21:22:11 +0900
Message-ID: [email protected]

POSIX threade$B$O$h$/$o$+$i$J$$$N$G$9$,!"$D$i$D$i9M$($F$$?$H$3e(B
e$B$m!"e(Bforke$BA0$Ke(Btimer threade$B$r;
$a$F!“e(Bforke$B8e$K?F;RAPJ}$G$^$?e(Btimer
threade$B$rF0$+$;$P$$$$$s$8$c$J$$$+$H$$$&5$$,$7$F$-$^$7$?!#e(B
e$B<j85$K$O4D6-$,$J$$$N$G$+$:$R$3$5$s$K0J2<$N%Q%C%A$r;n$7$F$b$ie(B
e$B$C$?$H$3$m!”$$$A$*$&F0$/$h$&$K$J$k$_$?$$$G$9!#e(B

e$B;d$N4D6-$G$O%@%a$G$7$?!%e(B
e$B%Q%C%A$NE,MQA0$O%4%$H$7$F;D$k%W%m%;%9!%9%l%C%I$,0l$D$G$7$?$,!$e(B
e$B%Q%C%A$NE,MQ8e$OO;$D$K$J$j$^$7$?!%e(B(^
^;

e$B%A%1%C%He(B #1872 e$B$,99?7$5$l$^$7$?!#e(B (by Kazuhiko Shiozaki)

Mandriva 2009.1 (glibc-2.9-0.20081113.5.1mnb2)e$B$G$O:F8=$7$^$;$s$G$7$?$,!“e(B
e$B>e5-$N4D6-$G$b!“2?I42s$H;n$7$F$_$k$H!“e(B2-5%e$BDxEY$N3NN($G<:GT$7$^$7$?!#e(B
e$B$G!”$3$N4D6-$G$b$J$+$`$ie(B(e$B$&e(B)e$B$5$sDs0F$N%Q%C%A$r$”$F$k$H!”<:GT$7$J$/$J$j$^$7$?!#e(B

nadokae$B$,e(B–daemone$B$GF0$+$J$+$C$?$je(Bquickmle$B$,$5$5$C$?$j$9$k$N$O:$$k$N$G!“e(B
e$B$H$j$”$($:e(B–disable-pthreade$B$G%S%k%I$7$F2sHr$7$F$$$^$9!#e(B

e$B$^$?!"e(Bruby-trunk
(r.24372)e$B$G$O$I$A$i$N4D6-$G$b:F8=$7$^$;$s$G$7$?!#e(B

e$B$+$:$R$3e(B


http://redmine.ruby-lang.org/issues/show/1872

e$B%A%1%C%He(B #1872 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

e$B4XO"$9$k$H?dB,$5$l$ke(B Bug #2603
e$B$,2r7h$7$^$7$?$,!"$3$A$i$O8=>u$I$s$J46$8$G$9$+!#e(B
e$B$"$H!"1J0f$5$s$N4D6-$C$F%G%#%9%H%j%S%e!<%7%g%s2?$G$9$+e(B?
e$B$^[email protected]:F8=$9$k$h$&[email protected]$C$?$i4D6-$rC/$+$,MQ0U$G$-$k$h$&$Ke(B

http://redmine.ruby-lang.org/issues/show/1872

e$B%A%1%C%He(B #1872 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

e$B%9%F!<%?%9e(B Assignede$B$+$ie(BClosede$B$KJQ99e(B

e$B3NG’$"$j$,$H$&$4$6$$$^$7$?!#e(B
e$B$=$l$G$O$3$l$O2r7h$H$7$^$9!#e(B

http://redmine.ruby-lang.org/issues/show/1872

e$B1J0f!wCNG=!%6e9)Bg$G$9!%e(B

e$B$3$N$H$3$m<j$,2s$C$F$J$/$F!$DI?o$G$-$F$J$/$F$9$_$^$;$s!%e(B

From: Yui NARUSE [email protected]
Subject: [ruby-dev:40123] [Bug #1872] [ruby_1_8] Kernel#system doesn’t
work in forked process
Date: Fri, 22 Jan 2010 01:43:37 +0900
Message-ID: [email protected]

e$B4XO"$9$k$H?dB,$5$l$ke(B Bug #2603 e$B$,2r7h$7$^$7$?$,!"$3$A$i$O8=>u$I$s$J46$8$G$9$+!#e(B

e$B;n$7$^$7$?!%LdBj$O2r7h$7$?$h$&$K8+$($^$9!%e(B

e$B$"$H!"1J0f$5$s$N4D6-$C$F%G%#%9%H%j%S%e!<%7%g%s2?$G$9$+e(B?

Vine-3.2 e$B%Y!<%9$G$9!%e(B
e$B$+$J$j8E$/!$%5%]!<%H$b$J$/$J$C$?4D6-$G$9$,!$e(B
e$B=t;v>p$"$C$F$=$N$^$^;D$7$F$$$kBeJ*$G$9!%e(B

e$B$=$s$J8E$$$b$N$OCN$i$M$’$h$H$$$&0U8+$b$"$j$=$&$G$9$,!$e(B
e$B40A4$KL5;k$7$F$$$$$[$I$K$O8E$/$J$$$H;W$C$F$^$9!%e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs