[#105450] [Ruby master Feature#18228] Add a `timeout` option to `IO.copy_stream` — "byroot (Jean Boussier)" <noreply@...>
SXNzdWUgIzE4MjI4IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGJ5cm9vdCAoSmVhbiBCb3Vzc2llciku
11 messages
2021/09/27
[ruby-core:105332] [Ruby master Feature#18151] Incorrect Resolv result when DNS server is unreachable
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2021-09-18 00:22:12 UTC
List:
ruby-core #105332
Issue #18151 has been updated by jeremyevans0 (Jeremy Evans). Backport deleted (2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN) ruby -v deleted (ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]) Tracker changed from Bug to Feature The current behavior seems to be expected (the code explicitly rescues the internal ResolvError), so I would consider this a feature request and not a bug. I agree with you that it would be nice to be able to differentiate the cases. I've submitted a pull request to resolv to support a :raise_timeout_error option that allows for the behavior you want: https://github.com/ruby/resolv/pull/14 ---------------------------------------- Feature #18151: Incorrect Resolv result when DNS server is unreachable https://bugs.ruby-lang.org/issues/18151#change-93747 * Author: yann.gouverneur (Yann Gouverneur) * Status: Open * Priority: Normal ---------------------------------------- The Resolv class has an incorrect behavior when the DNS server can't be reached. The attached script highlight the issue which - depending on your needs in resolving host names - could be really problematic. Here's the output of the script: ``` $ ruby test_resolv.rb Resolution of an existing domain name -> OK ["142.250.184.68", "2a00:1450:4002:806::2004"] Resolution of a non existing domain name -> OK [] Attempt of resolving a domain name with an incorrect/unreachable DNS server -> KO [] -> Expecting: ResolvError ``` Obviously the result for both NXDOMAIN and failure to reach the DNS server is identical, hence it make impossible to handle errors programmatically. A proper result when the DNS server is not reachable would be to get a ResolvError exception fired. ---Files-------------------------------- test_resolv.rb (702 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>