[前][次][番号順一覧][スレッド一覧]

ruby-changes:44390

From: nobu <ko1@a...>
Date: Fri, 21 Oct 2016 16:06:33 +0900 (JST)
Subject: [ruby-changes:44390] nobu:r56463 (trunk): ruby.c: retry loading with GC

nobu	2016-10-21 16:06:27 +0900 (Fri, 21 Oct 2016)

  New Revision: 56463

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56463

  Log:
    ruby.c: retry loading with GC
    
    * ruby.c (open_load_file): retry after GC when the limit for open
      file descriptors reached.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56462)
+++ ChangeLog	(revision 56463)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Oct 21 16:06:25 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (open_load_file): retry after GC when the limit for open
+	  file descriptors reached.
+
 Fri Oct 21 11:34:17 2016  Pascal Schmid  <Lechindianer@u...>
 
 	* string.c (rb_str_sub, rb_str_gsub): [DOC] 'backlash' should read
Index: ruby.c
===================================================================
--- ruby.c	(revision 56462)
+++ ruby.c	(revision 56463)
@@ -1899,7 +1899,13 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1899
 #endif
 
 	if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
-	    rb_load_fail(fname_v, strerror(errno));
+	    int e = errno;
+	    if (!rb_gc_for_fd(e)) {
+		rb_load_fail(fname_v, strerror(e));
+	    }
+	    if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
+		rb_load_fail(fname_v, strerror(errno));
+	    }
 	}
 	rb_update_max_fd(fd);
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]