diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-01 05:40:02 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-01 05:40:02 +0000 |
commit | c91b7154f278c7c9ed1f46b61b5e1155cf28066a (patch) | |
tree | 25aa26b8506637abec376848273118a065db4658 /test | |
parent | 2c26edc15c4d30494601d5df11daea4a26a38465 (diff) |
merge revision(s) 64007,64019,64020: [Backport #14929]
thread.c (do_select): fix leak on exception
When do_select is interrupted and raise happens from
RUBY_VM_CHECK_INTS_BLOCKING, the original FD sets we copied
do not get freed, leading to a memory leak. Wrap up all the
FD sets into a Ruby object to ensure the GC can release an
allocations made for rb_fdset_t.
This leak existed since Ruby 2.0.0 (r36430)
[Bug #14929]
increase timeout seconds.
* test/ruby/test_io.rb (test_select_leak): increase timeout seconds
to pass this test on a high-load machine.
60 sec is not enough at all
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index b95f837571..adef8a5292 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3742,4 +3742,21 @@ __END__ con.close end end if Socket.const_defined?(:MSG_OOB) + + def test_select_leak + assert_no_memory_leak([], <<-"end;", <<-"end;", rss: true, timeout: 60) + r, w = IO.pipe + rset = [r] + wset = [w] + Thread.new { IO.select(rset, wset, nil, 0) }.join + end; + 20_000.times do + th = Thread.new { IO.select(rset, wset) } + Thread.pass until th.stop? + th.kill + th.join + GC.start + end + end; + end end |