diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-06 13:13:10 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-06 13:47:09 +0900 |
commit | b247ac086e60a6cee99ea1989277c5c66b0541de (patch) | |
tree | c350b3d308c9d1b12c760b5cc62d0ff416f76873 /tool | |
parent | 7397b9f7867b787280c1a5c955c40bd44fcb8f35 (diff) |
Ignore FDs kept by system library
`getaddrinfo` on macOS seems keeping FDs to query host names
internally.
Diffstat (limited to 'tool')
-rw-r--r-- | tool/lib/leakchecker.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb index 293ebe6a9a..bd0e24ba2e 100644 --- a/tool/lib/leakchecker.rb +++ b/tool/lib/leakchecker.rb @@ -89,6 +89,19 @@ class LeakChecker }.sort.each {|s| str << s } + else + begin + io = IO.for_fd(fd, autoclose: false) + s = io.stat + rescue Errno::EBADF + # something un-stat-able + next + else + next if /darwin/ =~ RUBY_PLATFORM and [0, -1].include?(s.dev) + str << ' ' << s.inspect + ensure + io.close + end end puts "Leaked file descriptor: #{test_name}: #{fd}#{str}" puts " The IO was created at #{pos}" if pos |