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

ruby-changes:61389

From: Yusuke <ko1@a...>
Date: Wed, 27 May 2020 02:13:14 +0900 (JST)
Subject: [ruby-changes:61389] 962c302a1a (master): test/drb/test_drbssl.rb: skip LeakChecker as openssl keeps /dev/random

https://git.ruby-lang.org/ruby.git/commit/?id=962c302a1a

From 962c302a1ae8e50738c36adb61c8ec9c9fa5a49b Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 27 May 2020 02:07:38 +0900
Subject: test/drb/test_drbssl.rb: skip LeakChecker as openssl keeps
 /dev/random

and /dev/urandom intentionally.  OpenSSL::PKey::RSA.new opens the two
random generators and keeps the file descriptors.

https://github.com/openssl/openssl/blob/93f99b681ab5a1cf7062053323e09b0cad5ff854/crypto/rand/rand_unix.c#L674

They are detected by the LeakChecker as fd leak, but it is intentional.

http://rubyci.s3.amazonaws.com/graviton2/ruby-master/log/20200526T160005Z.log.html.gz
```
[  597/20199] DRbTests::TestDRbSSLAry#test_01 = 0.29 s
Leaked file descriptor: DRbTests::TestDRbSSLAry#test_01: 8 #<File::Stat dev=0x6, ino=11, mode=020666, nlink=1, uid=0, gid=0, rdev=0x109, size=0, blksize=4096, blocks=0, atime=2020-05-23 14:45:13.751999995 +0000, mtime=2020-05-23 14:45:13.751999995 +0000, ctime=2020-05-23 14:45:13.751999995 +0000>
Leaked file descriptor: DRbTests::TestDRbSSLAry#test_01: 9 #<File::Stat dev=0x6, ino=10, mode=020666, nlink=1, uid=0, gid=0, rdev=0x108, size=0, blksize=4096, blocks=0, atime=2020-05-23 14:45:13.755999995 +0000, mtime=2020-05-23 14:45:13.755999995 +0000, ctime=2020-05-23 14:45:13.755999995 +0000>
```

diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index 8ab010e..1763b38 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -59,6 +59,7 @@ end https://github.com/ruby/ruby/blob/trunk/test/drb/test_drbssl.rb#L59
 class TestDRbSSLAry < Test::Unit::TestCase
   include DRbAry
   def setup
+    LeakChecker.skip if defined?(LeakChecker)
     @drb_service = DRbSSLService.new
     super
     setup_service 'ut_array_drbssl.rb'
diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb
index db274ca..5311cdd 100644
--- a/tool/lib/leakchecker.rb
+++ b/tool/lib/leakchecker.rb
@@ -4,6 +4,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L4
 
   def initialize
     @fd_info = find_fds
+    @@skip = false
     @tempfile_info = find_tempfiles
     @thread_info = find_threads
     @env_info = find_env
@@ -63,7 +64,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L64
       }
     end
     fd_leaked = live2 - live1
-    if !fd_leaked.empty?
+    if !@@skip && !fd_leaked.empty?
       leaked = true
       h = {}
       ObjectSpace.each_object(IO) {|io|
@@ -123,6 +124,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L124
       }
     end
     @fd_info = live2
+    @@skip = false
     return leaked
   end
 
@@ -290,4 +292,8 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L292
     end
     output.puts(*a)
   end
+
+  def self.skip
+    @@skip = true
+  end
 end
-- 
cgit v0.10.2


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

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