From: shatrov@... Date: 2020-01-03T13:49:29+00:00 Subject: [ruby-core:96642] [Ruby master Bug#16476] Socket.getaddrinfo cannot be interrupted by Timeout.timeout Issue #16476 has been reported by kirs (Kir Shatrov). ---------------------------------------- Bug #16476: Socket.getaddrinfo cannot be interrupted by Timeout.timeout https://bugs.ruby-lang.org/issues/16476 * Author: kirs (Kir Shatrov) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- It seems like the blocking syscall done by `Socket.getaddrinfo` blocks Ruby VM in a way that Timeout.timeout has no effect. See reproduction steps in getaddrinfo_interrupt.rb attached. This affects all modern Ruby versions, including the latest 2.7.0. Combined with default 10s resolv timeout on many Linux systems, this can have a very noticeable effect on production Ruby apps being not resilient to slow DNS resolutions, and being unable to fail fast even with `Timeout.timeout`. While https://bugs.ruby-lang.org/issues/15553 improves the situation, `Socket.getaddrinfo` is still blocking the VM and Timeout has no effect. I'd like to discuss what could be done to make that call non-blocking for threads in Ruby VM. ---Files-------------------------------- getaddrinfo_interrupt.rb (881 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: