From: akr@fsij.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91426] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
Date: Wed, 06 Feb 2019 12:44:52 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-76685.20190206124451.3df745ee7d174ab9@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15553.20190121035835@ruby-lang.org
Issue #15553 has been updated by akr (Akira Tanaka).
I think timeout library is not effective for getaddrinfo method (without getaddrinfo_a).
What the patch tries to change on a platform which has no getaddrinfo_a?
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76685
* Author: Glass_saga (Masaki Matsushita)
* Status: Open
* Priority: Normal
* Assignee:
* Target version: 2.7
----------------------------------------
Currently, we use Timeout in Net::HTTP and other standard libraries.
lib/net/http.rb
```
945 s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
946 begin
947 TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
948 rescue => e
949 raise e, "Failed to open TCP connection to " +
950 "#{conn_address}:#{conn_port} (#{e.message})"
951 end
952 }
```
Socket.tcp supports connect_timeout, but Addrinfo.getaddrinfo doesn't support timeout.
We need to use Timeout to wait name resolution.
In this patch, Addrinfo.getaddrinfo support timeout and Socket.tcp accepts resolv_timeout.
It uses getaddrinfo_a(3) if available, otherwise it uses Timeout.
We can avoid thread creation to make a TCP connection if getaddrinfo_a(3) is available.
---Files--------------------------------
patch.diff (13.2 KB)
--
https://bugs.ruby-lang.org/
next prev parent reply other threads:[~2019-02-06 12:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
2019-01-21 3:58 ` [ruby-core:91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout glass.saga
2019-01-26 20:49 ` [ruby-core:91289] " Eric Wong
2019-01-27 20:37 ` [ruby-core:91303] " Masaki Matsushita
2019-02-06 10:21 ` [ruby-core:91422] " Eric Wong
2019-01-21 8:58 ` [ruby-core:91208] " pdahorek
2019-01-23 14:13 ` [ruby-core:91229] " naruse
2019-01-23 21:47 ` [ruby-core:91236] " glass.saga
2019-02-06 9:22 ` [ruby-core:91419] " akr
2019-02-06 12:44 ` akr [this message]
2019-02-06 19:08 ` [ruby-core:91441] " eregontp
2019-03-24 5:39 ` [ruby-core:91962] " glass.saga
2019-04-03 10:40 ` [ruby-core:92126] " maciej
2019-08-30 3:23 ` [ruby-core:94676] [Ruby master " shyouhei
2019-08-30 8:07 ` [ruby-core:94681] " glass.saga
2019-09-09 6:39 ` [ruby-core:94856] " glass.saga
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-76685.20190206124451.3df745ee7d174ab9@ruby-lang.org \
--to=ruby-core@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).