GC problem (?) in 1.8

å?é?¨ã§ã?ã??

æ?°æ?¥å?ã?ã??å?é?¨ã®autobuildで1.8ã?ã?¿ã?¤ã? ã?¢ã?¦ã??ã?てã?ã??のにã?æ°?ä»?きのæ?¹ã??ã?
ã??ã??ã??とæ?ã?まã?ã??
現象とã?てはå®?å?¨ã«ç?¡åå¿?になã??ç?¶æ³ãªã?ã?ã?gdbで横ã?ã??attachã?てみã?とã?
ã?ã?ã©ã?ã??ã??GCに突å?¥ã?ã?まま帰ってã?なくなってã?ã??ã??ã?にè¦?ã?まã?ã??

とã??ã?ã?ã?私ではã?のくã??ã?までã?ã?追ã?きã??てなã?のでã?ã?ã?ä»?にどのã??ã?な
æ??å ±ã?å¿?要そã?でã?ã??ã?ã??

In article [email protected],
URABE Shyouhei [email protected] writes:

e$B?tF|A0$+$iKNIt$Ne(Bautobuilde$B$Ge(B1.8e$B$,%?%$%`%“%&%H$7$F$$$k$N$K$*5$IU$-$NJ}$b$*e(B
e$B$i$l$k$H;W$$$^$9!#e(B
e$B8=>]$H$7$F$O40A4$KL5H?1~$K$J$k>u67$J$?$a!“e(Bgdbe$B$G2#$+$ie(Battache$B$7$F$_$?$H$3e(B
e$B$m!”$I$&$d$ie(BGCe$B$KFMF~$7$?$^$^5”$C$F$3$J$/$J$C$F$$$k$h$&$K8+$($^$9!#e(B

e$B$H$j$"$($:;d$G$O$3$N$/$i$$$^$G$7$+DI$$$-$l$F$J$$$N$G$9$,!"B>$K$I$N$h$&$Je(B
e$B>pJs$,I,MW$=$&$G$7$g$&$+e(B?

http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/summary.html
http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/log/20060616T003305.txt.gz
e$B$@$H!"e(Btest_process.rb e$B$,2x$7$$$N$G<j$rF~$l$F$_$^$7$?$,$I$&$Ge(B
e$B$7$g$&$+!#e(B

e$BKNIt$G$9!#e(B

Tanaka A. wrote:

test_process.rb e$B$,2x$7$$$N$G<j$rF~$l$F$_$^$7$?$,$I$&$G$7$g$&$+!#e(B

0F0Ee$B$K$J$j$^$7$?!#e(B

e$B$b$&$A$g$C$HFM$C9~$s$GD4$Y$F$_$k$H!"e(B

% ruby-1.8 -ve’
f = Process::RLIMIT_NOFILE
a = Process.getrlimit f
p a
Process.setrlimit f, 0, a[1]
b = Process.getrlimit f
p b
Process.setrlimit f, a[0], a[1]’
ruby 1.8.5 (2006-06-21) [powerpc-darwin8.6.0]
[256, 9223372036854775807]
[0, 10240]
-e:8:in `setrlimit’: Operation not permitted - setrlimit (Errno::EPERM)
from -e:9
zsh: exit 1 ruby-1.8

e$B$H$+$$$C$?>u67$,H/@8$7$F$$$k$h$&$G$9!#e(Brlim_maxe$B$,Bg$-$9$.$Ge(BEPERMe$B$K$J$C$Fe(B
e$B$$$k$N$O$"$k0UL#@5>o$G$9$,!"e(B

  • e$B:G=i$K<h$l$F$kCM$,$*$+$7$$e(B

e$B$?$H$(e(BRLIMIT_NOFILEe$B$,e(B0e$B$N$^$^$@$H$7$F$be(BGCe$B$,;_$^$i$J$/$J$k$N$O$I$&$J$N$+e(B
e$B$3$N$"$?$j$KLdBj$,$"$k$h$&$J5$$,$7$^$9!#e(B

In article [email protected],
URABE Shyouhei [email protected] writes:

e$B$H$+$$$C$?>u67$,H/@8$7$F$$$k$h$&$G$9!#e(Brlim_maxe$B$,Bg$-$9$.$Ge(BEPERMe$B$K$J$C$Fe(B
e$B$$$k$N$O$"$k0UL#@5>o$G$9$,!"e(B

  • e$B:G=i$K<h$l$F$kCM$,$*$+$7$$e(B

e$B$3$C$A$O$h$/$o$+$j$^$;$s!#e(B

  • e$B$?$H$(e(BRLIMIT_NOFILEe$B$,e(B0e$B$N$^$^$@$H$7$F$be(BGCe$B$,;_$^$i$J$/$J$k$N$O$I$&$J$N$+e(B
    e$B$3$N$“$?$j$KLdBj$,$”$k$h$&$J5$$,$7$^$9!#e(B

e$B$3$l$Oe(B sock_s_socketpair e$B$,!“e(BGC e$B$rB3$1$F$$$1$P$-$C$He(B
descriptor e$B$,6u$/!”$H?.$8$F$$$k$+$i$G$9$M!#e(B

1e$B2s$G$"$-$i$a$k$J$i$3$&$G$7$g$&$+!#e(B

Index: ext/socket/socket.c

RCS file: /src/ruby/ext/socket/socket.c,v
retrieving revision 1.108.2.51
diff -u -p -r1.108.2.51 socket.c
— ext/socket/socket.c 17 Jun 2006 15:53:27 -0000 1.108.2.51
+++ ext/socket/socket.c 21 Jun 2006 18:58:06 -0000
@@ -2304,15 +2304,17 @@ sock_s_socketpair(klass, domain, type, p
VALUE klass, domain, type, protocol;
{
#if defined HAVE_SOCKETPAIR

  • int d, t, sp[2];
  • int d, t, p, sp[2];

  • int ret;

    setup_domain_and_type(domain, &d, type, &t);

  • again:
  • if (socketpair(d, t, NUM2INT(protocol), sp) < 0) {
  • if (errno == EMFILE || errno == ENFILE) {
  •   rb_gc();
    
  •   goto again;
    
  • }
  • p = NUM2INT(protocol);
  • ret = socketpair(d, t, p, sp);
  • if (ret < 0 && (errno == EMFILE || errno == ENFILE)) {
  •    rb_gc();
    
  •    ret = socketpair(d, t, p, sp);
    
  • }
  • if (ret < 0) {
    rb_sys_fail(“socketpair(2)”);
    }

e$BKNIt$G$9!#e(B

Tanaka A. wrote:

  • e$B:G=i$K<h$l$F$kCM$,$*$+$7$$e(B

e$B$3$C$A$O$h$/$o$+$j$^$;$s!#e(B

e$B$I$&$d$i$*$+$7$$$H;W$C$?$3$NCM$Oe(BRLIM_INFINITYe$B$N$h$&$G$9!#$H$$$&$o$1$G!“e(B
e$BLdBjE@$O!Ve(Bsetrlimit(2)e$B$Ke(B
RLIMIT_INFINITYe$B$rEO$9$H!”$J$s$+$X$s$JJQ49$,$+e(B
e$B$+$C$F$7$^$&$h$&$K8+$($k!W$H$$$&E@$G$9$M!#$Y$D$Ke(BRubye$B8GM-$NLdBj$H$$$&$o$1e(B
e$B$G$b$J$5$=$&$G$9!#0J2<$N$h$&$Ke(Bpythone$B$K$bF1MM$NLdBj$,$"$k$3$H$,4QB,$G$-$^$9!#e(B

% python
Python 2.3.5 (#1, Aug 22 2005, 22:13:23)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import resource
f = resource.RLIMIT_NOFILE
a = resource.getrlimit(f)
print a
(256L, 9223372036854775807L)

resource.setrlimit(f, (0, a[1]))
b = resource.getrlimit(f)
print b
(0L, 10240L)

resource.setrlimit(f, a)
Traceback (most recent call last):
File “”, line 1, in ?
ValueError: not allowed to raise maximum limit

^D
%

In article [email protected],
URABE Shyouhei [email protected] writes:

e$B$I$&$d$i$*$+$7$$$H;W$C$?$3$NCM$Oe(BRLIM_INFINITYe$B$N$h$&$G$9!#$H$$$&$o$1$G!“e(B
e$BLdBjE@$O!Ve(Bsetrlimit(2)e$B$Ke(B RLIMIT_INFINITYe$B$rEO$9$H!”$J$s$+$X$s$JJQ49$,$+e(B
e$B$+$C$F$7$^$&$h$&$K8+$($k!W$H$$$&E@$G$9$M!#$Y$D$Ke(BRubye$B8GM-$NLdBj$H$$$&$o$1e(B
e$B$G$b$J$5$=$&$G$9!#0J2<$N$h$&$Ke(Bpythone$B$K$bF1MM$NLdBj$,$"$k$3$H$,4QB,$G$-$^$9!#e(B

e$B$D$$e(B OpenDarwin e$B$N%=!<%9$rD/$a$F$7$^$C$?$H$3$m!"e(B

src/xnu/bsd/kern/kern_resource.c e$B$Ke(B

    case RLIMIT_NOFILE:
            /*
            * Only root can set the maxfiles limits, as it is 

systemwide resource
*/
if ( is_suser() ) {
if (limp->rlim_cur > maxfiles)
limp->rlim_cur = maxfiles;
if (limp->rlim_max > maxfiles)
limp->rlim_max = maxfiles;
}
else {
if (limp->rlim_cur > maxfilesperproc)
limp->rlim_cur = maxfilesperproc;
if (limp->rlim_max > maxfilesperproc)
limp->rlim_max = maxfilesperproc;
}
break;

e$B$H$$$&$h$&$J%3!<%I$,$"$j!"e(Bmaxfilesperproc e$B$G8!:w$9$k$He(B
http://lists.apple.com/archives/macos-x-server/2004/May/msg01103.html
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2005/05/panther_de_orac_dc5e.html
e$B$H$+$Ne(B sysctl -a e$B$N7k2LCf$Ke(B
kern.maxfilesperproc = 10240
e$B$H$$$&$N$,8+$i$l$^$9!#e(B

f = resource.RLIMIT_NOFILE
a = resource.getrlimit(f)
print a
(256L, 9223372036854775807L)
resource.setrlimit(f, (0, a[1]))
b = resource.getrlimit(f)
print b
(0L, 10240L)

e$B$3$3$Ne(B 10240 e$B$H4X78$"$C$?$j$7$J$$$G$7$g$&$+!#e(B