< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #14571 has been updated by nobu (Nobuyoshi Nakada).
Just to clarify, do those file descriptors get closed by GC?
----------------------------------------
Bug #14571: File descriptor leak in resolv.rb
https://bugs.ruby-lang.org/issues/14571#change-70801
* Author: quixoten (Devin Christensen)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
There's an edge case in resolv.rb that can lead to file descriptor leaks on a highly saturated system (logstash in our case).

(the cliff at the end is from a restart of the application)
We're using the logstash-filter-dns plugin which [uses timeout](https://github.com/logstash-plugins/logstash-filter-dns/blob/v3.0.7/lib/logstash/filters/dns.rb#L250-L252).
When a timeout fires while [waiting](https://github.com/ruby/ruby/blob/8032b00f8e43be6e34f93005a17e26bc6d89f1c1/lib/resolv.rb#L649-L658) for a [random](https://github.com/ruby/ruby/blob/8032b00f8e43be6e34f93005a17e26bc6d89f1c1/lib/resolv.rb#L752) [port](https://github.com/ruby/ruby/blob/8032b00f8e43be6e34f93005a17e26bc6d89f1c1/lib/resolv.rb#L805), the new object is never returned to the caller. Instead `requester` is [set to nil](https://github.com/ruby/ruby/blob/8032b00f8e43be6e34f93005a17e26bc6d89f1c1/lib/resolv.rb#L514). There's no handle to any sockets that were created in the initializer, so they can't be closed, and one ore more file descriptors is leaked.
(This if my first patch submission, let me know what I can fix or do better.)
---Files--------------------------------
add-failing-tests.patch (1.39 KB)
fix-leak.patch (5.01 KB)
combined.patch (6.4 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>