Project

General

Profile

Actions

Bug #20198

closed

Threaded DNS resolver does not propagate errno to the calling thread

Added by kjtsanaktsidis (KJ Tsanaktsidis) 6 months ago. Updated 5 months ago.


Description

If we get a return value of EAI_SYSTEM from getaddrinfo, we transform that into an appropriate Errno:: exception on the Ruby side. However, because we now run the actual call to getaddrinfo in a thread, we lose that errno value (because errno is thread-local). So, what we actually raise in case of EAI_SYSTEM is just the last error which happened on the calling thread - e.g. this ECHILD which presumably got set in the bowels of pthreads somewhere:

   1)
  Socket::IPSocket#getaddress raises an error on unknown hostnames ERROR
  Expected SocketError
  but got: Errno::ECHILD (No child processes - getaddrinfo)
  /home/runner/work/ruby/ruby/src/spec/ruby/library/socket/ipsocket/getaddress_spec.rb:22:in `getaddress'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/socket/ipsocket/getaddress_spec.rb:22:in `block (3 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/socket/ipsocket/getaddress_spec.rb:21:in `block (2 levels) in <top (required)>'
  /home/runner/work/ruby/ruby/src/spec/ruby/library/socket/ipsocket/getaddress_spec.rb:4:in `<top (required)>'
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0