Skip to content

Commit c1ad2a8

Browse files
committed
Merge branch 'master-2.4' into dist/2.4/trusty
2 parents eb4ba39 + f9808ab commit c1ad2a8

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From: Sorah Fukumori <[email protected]>
2+
Date: Sat, 13 Jul 2019 11:52:24 +0900
3+
Subject: port test_io.rb(test_select_leak) from trunk
4+
5+
---
6+
test/ruby/test_io.rb | 27 ++++++++++++++++++++++-----
7+
1 file changed, 22 insertions(+), 5 deletions(-)
8+
9+
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
10+
index 200db7a..b9c835c 100644
11+
--- a/test/ruby/test_io.rb
12+
+++ b/test/ruby/test_io.rb
13+
@@ -3564,18 +3564,35 @@ def test_write_no_garbage
14+
end
15+
16+
def test_select_leak
17+
- assert_no_memory_leak([], <<-"end;", <<-"end;", rss: true, timeout: 60)
18+
+ # avoid malloc arena explosion from glibc and jemalloc:
19+
+ env = {
20+
+ 'MALLOC_ARENA_MAX' => '1',
21+
+ 'MALLOC_ARENA_TEST' => '1',
22+
+ 'MALLOC_CONF' => 'narenas:1',
23+
+ }
24+
+ assert_no_memory_leak([env], <<-"end;", <<-"end;", rss: true, timeout: 60)
25+
r, w = IO.pipe
26+
rset = [r]
27+
wset = [w]
28+
+ exc = StandardError.new(-"select used to leak on exception")
29+
+ exc.set_backtrace([])
30+
Thread.new { IO.select(rset, wset, nil, 0) }.join
31+
end;
32+
- 20_000.times do
33+
- th = Thread.new { IO.select(rset, wset) }
34+
+ th = Thread.new do
35+
+ Thread.handle_interrupt(StandardError => :on_blocking) do
36+
+ begin
37+
+ IO.select(rset, wset)
38+
+ rescue
39+
+ retry
40+
+ end while true
41+
+ end
42+
+ end
43+
+ 50_000.times do
44+
Thread.pass until th.stop?
45+
- th.kill
46+
- th.join
47+
+ th.raise(exc)
48+
end
49+
+ th.kill
50+
+ th.join
51+
end;
52+
end
53+
end

debian/patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0001-port-test_io.rb-test_select_leak-from-trunk.patch

0 commit comments

Comments
 (0)