[ruby-core:85327] Re: [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout

From: Eric Wong <normalperson@...>
Date: 2018-02-01 16:28:32 UTC
List: ruby-core #85327
[email protected] wrote:
> Instead of using TCPSocket.open, wrapped in Timeout.timeout,
> that will create a temporary thread. By using Socket.tcp with
> the connect_timeout argument for open_timeout the connection
> opening is much more efficient as the kernels timeout is used
> instead. 

Unfortunately, we can't do this, yet.  The Addrinfo calls use
getaddrinfo(3) which doesn't support timeout natively.

My goals for later this year is:

1) implement Timeout in the VM itself so it doesn't need to create
   a temporary thread.

2) update resolv-replace.rb to cover Addrinfo cases, including
   nscd cache lookup for glibc compatibility.

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next