diff options
author | Kir Shatrov <[email protected]> | 2020-08-27 08:39:13 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-27 16:39:13 +0900 |
commit | 2038cc6cab6ceeffef3ec3a765c70ae684f829ed (patch) | |
tree | c508ac47f217e759526f08b04684e96dfec2ff4d /test/socket | |
parent | 1035a3b202ee86bf2b0a1d00eefcfff0d7ab9f6b (diff) |
Make Socket.getaddrinfo interruptible (#2827)
Before, Socket.getaddrinfo was using a blocking getaddrinfo(3) call.
That didn't allow to wrap it into Timeout.timeout or interrupt the thread in any way.
Combined with the default 10 sec resolv timeout on many Unix systems, this can
have a very noticeable effect on production Ruby apps being not
resilient to DNS outages and timing out name resolution, and being unable to fail fast even
with Timeout.timeout.
Since we already have support for getaddrinfo_a(3), the async version
of getaddrinfo, we should be able to make Socket.getaddrinfo leverage that
when getaddrinfo_a version is available in the system (hence #ifdef
HAVE_GETADDRINFO_A).
Related tickets:
https://bugs.ruby-lang.org/issues/16476
https://bugs.ruby-lang.org/issues/16381
https://bugs.ruby-lang.org/issues/14997
Notes
Notes:
Merged-By: mmasaki <[email protected]>
Diffstat (limited to 'test/socket')
-rw-r--r-- | test/socket/test_addrinfo.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index d516c772d9..1421c153a0 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -103,7 +103,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase end def test_error_message - e = assert_raise_with_message(SocketError, /getaddrinfo:/) do + e = assert_raise_with_message(SocketError, /getaddrinfo/) do Addrinfo.ip("...") end m = e.message |