Project

General

Profile

Bug #11852

test_io.rb fails when maxproc < 1024

Added by kimuraw (Wataru Kimura) about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
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
#1

Updated by hsbt (Hiroshi SHIBATA) about 4 years ago

  • Status changed from Open to Closed

Applied in changeset r53227.


  • test/ruby/test_io.rb: handled rlimit value same as r52277 [Bug #11852][ruby-dev:49446]

Updated by usa (Usaku NAKAMURA) almost 4 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: UNKNOWN, 2.1: DONE, 2.2: REQUIRED

ruby_2_1 r54436 merged revision(s) 53227.

Updated by nagachika (Tomoyuki Chikanaga) almost 4 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: DONE, 2.2: REQUIRED to 2.0.0: UNKNOWN, 2.1: DONE, 2.2: DONE

Backported into ruby_2_2 branch at r54442.

Also available in: Atom PDF