Project

General

Profile

Actions

Bug #11852

closed

test_io.rb fails when maxproc < 1024

Added by kimuraw (Wataru Kimura) over 8 years ago. Updated almost 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-12-20 trunk 53216) [x86_64-darwin14]
[ruby-dev:49446]

Description

maxprocのhard limitが小さい環境でtest_ioがErrorで失敗します。
OS X 10.11.2, OS X 10.10.5上のtrunk, 2.2.4, 2.1.8で確認しました。

$ ./ruby -e 'p Process.getrlimit(Process::RLIMIT_NPROC)'
[266, 532]
$ limit -h maxproc
maxproc         532
$ make TESTS=ruby/test_io.rb test-all
:
1) Error:
TestIO#test_close_on_exec:
TypeError: no implicit conversion from nil to integer
/Users/kimuraw/work/ruby_trunk/test/ruby/test_io.rb:1104:in `wait'
/Users/kimuraw/work/ruby_trunk/test/ruby/test_io.rb:1104:in `ensure in ruby'
/Users/kimuraw/work/ruby_trunk/test/ruby/test_io.rb:1103:in `ruby'
/Users/kimuraw/work/ruby_trunk/test/ruby/test_io.rb:1661:in `test_close_on_exec'
  :
test/ruby/test_io.rb
1093   def ruby(*args) 
1094     args = ['-e', '$>.write($<.read)'] if args.empty? 
1095     ruby = EnvUtil.rubybin 
1096     opts = {} 
1097     opts[:rlimit_nproc] = 1024 if defined?(Process::RLIMIT_NPROC) #<<<
1098     f = IO.popen([ruby] + args, 'r+', opts)

opts[:rlimit_nproc]に環境の最大値より大きな値を渡すとエラーになるようです。
問題の起きない環境でもlimit -h maxproc 1023などすると再現します。
2.1.8のTestIO#test_dup_many()を参考に、環境の最大値と1024の小さいほうにするパッチを添付します。


Files

patch-test-ruby-test_io.rb.diff (593 Bytes) patch-test-ruby-test_io.rb.diff kimuraw (Wataru Kimura), 12/20/2015 12:11 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0