* [ruby-core:91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
@ 2019-01-21 3:58 ` glass.saga
2019-01-26 20:49 ` [ruby-core:91289] " Eric Wong
2019-01-21 8:58 ` [ruby-core:91208] " pdahorek
` (10 subsequent siblings)
11 siblings, 1 reply; 15+ messages in thread
From: glass.saga @ 2019-01-21 3:58 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91208] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[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-21 8:58 ` pdahorek
2019-01-23 14:13 ` [ruby-core:91229] " naruse
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: pdahorek @ 2019-01-21 8:58 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by ahorek (Pavel Rosický).
thanks for this PR. Many requests for fully async support in stdlib are blocked by this.
I think on Windows 8+ we can use https://docs.microsoft.com/cs-cz/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfoexa to avoid timeout?
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76446
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91229] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[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-21 8:58 ` [ruby-core:91208] " pdahorek
@ 2019-01-23 14:13 ` naruse
2019-01-23 21:47 ` [ruby-core:91236] " glass.saga
` (8 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: naruse @ 2019-01-23 14:13 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by naruse (Yui NARUSE).
Why hrtime.h is included?
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76476
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91236] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (2 preceding siblings ...)
2019-01-23 14:13 ` [ruby-core:91229] " naruse
@ 2019-01-23 21:47 ` glass.saga
2019-02-06 9:22 ` [ruby-core:91419] " akr
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: glass.saga @ 2019-01-23 21:47 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by Glass_saga (Masaki Matsushita).
> Why hrtime.h is included?
It's unnecessary. I'll remove it.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76481
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
2019-01-21 3:58 ` [ruby-core:91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout glass.saga
@ 2019-01-26 20:49 ` Eric Wong
2019-01-27 20:37 ` [ruby-core:91303] " Masaki Matsushita
0 siblings, 1 reply; 15+ messages in thread
From: Eric Wong @ 2019-01-26 20:49 UTC (permalink / raw)
To: ruby-core
glass.saga@gmail.com wrote:
> Feature #15553: Addrinfo.getaddrinfo supports timeout
> https://bugs.ruby-lang.org/issues/15553
Can we rely on resolv.rb more, instead? (and improve on it)
> It uses getaddrinfo_a(3) if available, otherwise it uses Timeout.
getaddrinfo_a(3) still spawns background threads in glibc;
so not a big win.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91303] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
2019-01-26 20:49 ` [ruby-core:91289] " Eric Wong
@ 2019-01-27 20:37 ` Masaki Matsushita
2019-02-06 10:21 ` [ruby-core:91422] " Eric Wong
0 siblings, 1 reply; 15+ messages in thread
From: Masaki Matsushita @ 2019-01-27 20:37 UTC (permalink / raw)
To: Ruby developers
> Can we rely on resolv.rb more, instead? (and improve on it)
That might be an option to avoid using Timeout.
> getaddrinfo_a(3) still spawns background threads in glibc; so not a big win.
As I briefly looked through glibc code, it seems to share and reuse
its background threads.
Please take a look at glibc/resolv/gai_misc.c and related files.
2019年1月26日(土) 12:49 Eric Wong <normalperson@yhbt.net>:
>
> glass.saga@gmail.com wrote:
> > Feature #15553: Addrinfo.getaddrinfo supports timeout
> > https://bugs.ruby-lang.org/issues/15553
>
> Can we rely on resolv.rb more, instead? (and improve on it)
>
> > It uses getaddrinfo_a(3) if available, otherwise it uses Timeout.
>
> getaddrinfo_a(3) still spawns background threads in glibc;
> so not a big win.
>
> Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91419] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (3 preceding siblings ...)
2019-01-23 21:47 ` [ruby-core:91236] " glass.saga
@ 2019-02-06 9:22 ` akr
2019-02-06 12:44 ` [ruby-core:91426] " akr
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: akr @ 2019-02-06 9:22 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by akr (Akira Tanaka).
I'm positive to use getaddrinfo_a if it is available.
However, if getaddrinfo_a is not available and timeout option is not set,
timeout library should not be loaded.
Also, it's welcome to improve resolv.rb.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76680
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91422] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
2019-01-27 20:37 ` [ruby-core:91303] " Masaki Matsushita
@ 2019-02-06 10:21 ` Eric Wong
0 siblings, 0 replies; 15+ messages in thread
From: Eric Wong @ 2019-02-06 10:21 UTC (permalink / raw)
To: ruby-core
Masaki Matsushita <glass.saga@gmail.com> wrote:
> > getaddrinfo_a(3) still spawns background threads in glibc; so not a big win.
> As I briefly looked through glibc code, it seems to share and reuse
> its background threads.
> Please take a look at glibc/resolv/gai_misc.c and related files.
Right, however Ruby 2.6+ also has USE_THREAD_CACHE enabled to
reuse threads. For applications which already uses short-lived
(Ruby) threads; this can even be a win because reusing Ruby
threads can improve locality.
I prefer sticking to resolve.rb.
c-ares <https://c-ares.haxx.se/> may be a another option if
resolve.rb isn't fast enough.
getaddrinfo_a(3) is the worst option IMHO.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91426] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (4 preceding siblings ...)
2019-02-06 9:22 ` [ruby-core:91419] " akr
@ 2019-02-06 12:44 ` akr
2019-02-06 19:08 ` [ruby-core:91441] " eregontp
` (5 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: akr @ 2019-02-06 12:44 UTC (permalink / raw)
To: ruby-core
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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91441] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (5 preceding siblings ...)
2019-02-06 12:44 ` [ruby-core:91426] " akr
@ 2019-02-06 19:08 ` eregontp
2019-03-24 5:39 ` [ruby-core:91962] " glass.saga
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: eregontp @ 2019-02-06 19:08 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by Eregon (Benoit Daloze).
akr (Akira Tanaka) wrote:
> I think timeout library is not effective for getaddrinfo method (without getaddrinfo_a).
That was also my experience trying to use SIGVTALRM to interrupt getaddrinfo(3): it had no effect, the code ignores EINTR and only ends after 5 seconds (its default timeout I guess).
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-76699
* 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/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:91962] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (6 preceding siblings ...)
2019-02-06 19:08 ` [ruby-core:91441] " eregontp
@ 2019-03-24 5:39 ` glass.saga
2019-04-03 10:40 ` [ruby-core:92126] " maciej
` (3 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: glass.saga @ 2019-03-24 5:39 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by Glass_saga (Masaki Matsushita).
File patch2.diff added
I updated the patch.
* get rid of Timeout from ext/socket/lib/socket.rb. If getaddrinfo_a() is not available, timeout is ignored.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-77296
* 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)
patch2.diff (11.6 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:92126] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (7 preceding siblings ...)
2019-03-24 5:39 ` [ruby-core:91962] " glass.saga
@ 2019-04-03 10:40 ` maciej
2019-08-30 3:23 ` [ruby-core:94676] [Ruby master " shyouhei
` (2 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: maciej @ 2019-04-03 10:40 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by maciej.mensfeld (Maciej Mensfeld).
This is also related to it: https://bugs.ruby-lang.org/issues/14997 - once the DNS timeout is in place (when available) I could give the #14997 a shot adding per ip timeout and including the resolving timeout in the overall timeout.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-77452
* 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)
patch2.diff (11.6 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:94676] [Ruby master Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (8 preceding siblings ...)
2019-04-03 10:40 ` [ruby-core:92126] " maciej
@ 2019-08-30 3:23 ` shyouhei
2019-08-30 8:07 ` [ruby-core:94681] " glass.saga
2019-09-09 6:39 ` [ruby-core:94856] " glass.saga
11 siblings, 0 replies; 15+ messages in thread
From: shyouhei @ 2019-08-30 3:23 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by shyouhei (Shyouhei Urabe).
Reviewed the patch and found no issues. So LGTM.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-81282
* 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)
patch2.diff (11.6 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:94681] [Ruby master Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (9 preceding siblings ...)
2019-08-30 3:23 ` [ruby-core:94676] [Ruby master " shyouhei
@ 2019-08-30 8:07 ` glass.saga
2019-09-09 6:39 ` [ruby-core:94856] " glass.saga
11 siblings, 0 replies; 15+ messages in thread
From: glass.saga @ 2019-08-30 8:07 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by Glass_saga (Masaki Matsushita).
Thank you for reviewing. I will commit it.
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-81287
* 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)
patch2.diff (11.6 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* [ruby-core:94856] [Ruby master Feature#15553] Addrinfo.getaddrinfo supports timeout
[not found] <redmine.issue-15553.20190121035835@ruby-lang.org>
` (10 preceding siblings ...)
2019-08-30 8:07 ` [ruby-core:94681] " glass.saga
@ 2019-09-09 6:39 ` glass.saga
11 siblings, 0 replies; 15+ messages in thread
From: glass.saga @ 2019-09-09 6:39 UTC (permalink / raw)
To: ruby-core
Issue #15553 has been updated by Glass_saga (Masaki Matsushita).
Assignee set to Glass_saga (Masaki Matsushita)
Status changed from Open to Closed
committed in 6382f5cc91ac9e36776bc854632d9a1237250da7
----------------------------------------
Feature #15553: Addrinfo.getaddrinfo supports timeout
https://bugs.ruby-lang.org/issues/15553#change-81477
* Author: Glass_saga (Masaki Matsushita)
* Status: Closed
* Priority: Normal
* Assignee: Glass_saga (Masaki Matsushita)
* 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)
patch2.diff (11.6 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-09-09 6:39 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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 ` [ruby-core:91426] " akr
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
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).