Skip to content

Commit

Permalink
test/drb/test_drbssl.rb: skip LeakChecker as openssl keeps /dev/random
Browse files Browse the repository at this point in the history
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>
```
  • Loading branch information
mame committed May 26, 2020
1 parent 135c6a4 commit 962c302
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/drb/test_drbssl.rb
Expand Up @@ -59,6 +59,7 @@ def test_05_eq
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'
Expand Down
8 changes: 7 additions & 1 deletion tool/lib/leakchecker.rb
Expand Up @@ -4,6 +4,7 @@ class LeakChecker

def initialize
@fd_info = find_fds
@@skip = false
@tempfile_info = find_tempfiles
@thread_info = find_threads
@env_info = find_env
Expand Down Expand Up @@ -63,7 +64,7 @@ def check_fd_leak(test_name)
}
end
fd_leaked = live2 - live1
if !fd_leaked.empty?
if !@@skip && !fd_leaked.empty?
leaked = true
h = {}
ObjectSpace.each_object(IO) {|io|
Expand Down Expand Up @@ -123,6 +124,7 @@ def check_fd_leak(test_name)
}
end
@fd_info = live2
@@skip = false
return leaked
end

Expand Down Expand Up @@ -290,4 +292,8 @@ def puts(*a)
end
output.puts(*a)
end

def self.skip
@@skip = true
end
end

0 comments on commit 962c302

Please sign in to comment.