From: "naruse (Yui NARUSE) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "naruse (Yui NARUSE)" <noreply@ruby-lang.org>
Subject: [ruby-core:117165] [Ruby master Bug#20198] Threaded DNS resolver does not propagate errno to the calling thread
Date: Thu, 14 Mar 2024 13:02:51 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-107256.20240314130251.10173@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-20198.20240122010539.10173@ruby-lang.org
Issue #20198 has been updated by naruse (Yui NARUSE).
Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
ruby_3_3 a889304fed63c3206f27d614ab75219271fb4ca9 merged revision(s) 6c0e58a54e3fda604386d9c409e2a9998bbc9352.
----------------------------------------
Bug #20198: Threaded DNS resolver does not propagate errno to the calling thread
https://bugs.ruby-lang.org/issues/20198#change-107256
* Author: kjtsanaktsidis (KJ Tsanaktsidis)
* Status: Closed
* Assignee: kjtsanaktsidis (KJ Tsanaktsidis)
* Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE
----------------------------------------
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)>'
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
prev parent reply other threads:[~2024-03-14 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 1:05 [ruby-core:116356] [Ruby master Bug#20198] Threaded DNS resolver does not propagate errno to the calling thread kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core
2024-01-22 1:08 ` [ruby-core:116357] " kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core
2024-01-22 3:38 ` [ruby-core:116359] " kjtsanaktsidis (KJ Tsanaktsidis) via ruby-core
2024-03-14 13:02 ` naruse (Yui NARUSE) via ruby-core [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-107256.20240314130251.10173@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
--cc=noreply@ruby-lang.org \
--cc=ruby-core@ml.ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).