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

ruby-changes:40277

From: usa <ko1@a...>
Date: Thu, 29 Oct 2015 23:28:29 +0900 (JST)
Subject: [ruby-changes:40277] usa:r52358 (ruby_2_1): merge revision(s) 52229, 52273, 52277, 52357: [Backport #11613]

usa	2015-10-29 23:28:16 +0900 (Thu, 29 Oct 2015)

  New Revision: 52358

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

  Log:
    merge revision(s) 52229,52273,52277,52357: [Backport #11613]
    
    Add rlimit_nproc to avoid to create many process [Bug #11613]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/test/ruby/test_io.rb
    branches/ruby_2_1/test/ruby/test_process.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 52357)
+++ ruby_2_1/version.h	(revision 52358)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.8"
 #define RUBY_RELEASE_DATE "2015-10-29"
-#define RUBY_PATCHLEVEL 408
+#define RUBY_PATCHLEVEL 409
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 10
Index: ruby_2_1/test/ruby/test_io.rb
===================================================================
--- ruby_2_1/test/ruby/test_io.rb	(revision 52357)
+++ ruby_2_1/test/ruby/test_io.rb	(revision 52358)
@@ -1048,7 +1048,9 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_io.rb#L1048
   def ruby(*args)
     args = ['-e', '$>.write($<.read)'] if args.empty?
     ruby = EnvUtil.rubybin
-    f = IO.popen([ruby] + args, 'r+')
+    opts = {}
+    opts[:rlimit_nproc] = 1024 if defined?(Process::RLIMIT_NPROC)
+    f = IO.popen([ruby] + args, 'r+', opts)
     pid = f.pid
     yield(f)
   ensure
@@ -1099,6 +1101,10 @@ class TestIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_io.rb#L1101
 
   def test_dup_many
     ruby('-e', <<-'End') {|f|
+      if defined?(Process::RLIMIT_NOFILE)
+        lim = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
+        Process.setrlimit(Process::RLIMIT_NOFILE, [lim, 1024].min)
+      end
       ok = 0
       a = []
       begin
Index: ruby_2_1/test/ruby/test_process.rb
===================================================================
--- ruby_2_1/test/ruby/test_process.rb	(revision 52357)
+++ ruby_2_1/test/ruby/test_process.rb	(revision 52358)
@@ -1448,7 +1448,7 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_process.rb#L1448
   end
 
   def test_aspawn_too_long_path
-    bug4315 = '[ruby-core:34833]'
+    bug4315 = '[ruby-core:34833] #7904 [ruby-core:52628] #11613'
     assert_fail_too_long_path(%w"echo |", bug4315)
   end
 
@@ -1458,11 +1458,13 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_process.rb#L1458
     cmds = Array.new(min, cmd)
     exs = [Errno::ENOENT]
     exs << Errno::E2BIG if defined?(Errno::E2BIG)
+    opts = {[STDOUT, STDERR]=>File::NULL}
+    opts[:rlimit_nproc] = 128 if defined?(Process::RLIMIT_NPROC)
     EnvUtil.suppress_warning do
       assert_raise(*exs, mesg) do
         begin
           loop do
-            Process.spawn(cmds.join(sep), [STDOUT, STDERR]=>File::NULL)
+            Process.spawn(cmds.join(sep), opts)
             min = [cmds.size, min].max
             cmds *= 100
           end

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r52229,52273,52277


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

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