ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:85324] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
       [not found] <redmine.issue-14430.20180201125158@ruby-lang.org>
@ 2018-02-01 12:51 ` carl.hoerberg
  2018-02-01 16:28   ` [ruby-core:85327] " Eric Wong
  2018-02-02  0:35 ` [ruby-core:85331] " shevegen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 5+ messages in thread
From: carl.hoerberg @ 2018-02-01 12:51 UTC (permalink / raw)
  To: ruby-core

Issue #14430 has been reported by carl.hoerberg (Carl Hörberg).

----------------------------------------
Feature #14430: net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
https://bugs.ruby-lang.org/issues/14430

* Author: carl.hoerberg (Carl Hörberg)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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. 

PR at: https://github.com/ruby/ruby/pull/1806



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:85327] Re: [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
  2018-02-01 12:51 ` [ruby-core:85324] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout carl.hoerberg
@ 2018-02-01 16:28   ` Eric Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2018-02-01 16:28 UTC (permalink / raw)
  To: ruby-core

carl.hoerberg@gmail.com 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:85331] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
       [not found] <redmine.issue-14430.20180201125158@ruby-lang.org>
  2018-02-01 12:51 ` [ruby-core:85324] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout carl.hoerberg
@ 2018-02-02  0:35 ` shevegen
  2018-02-04 12:37 ` [ruby-core:85374] " carl.hoerberg
  2019-11-05 13:32 ` [ruby-core:95701] [Ruby master " jean.boussier
  3 siblings, 0 replies; 5+ messages in thread
From: shevegen @ 2018-02-02  0:35 UTC (permalink / raw)
  To: ruby-core

Issue #14430 has been updated by shevegen (Robert A. Heiler).


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

There be dragons hiding in the VM.

\o/

----------------------------------------
Feature #14430: net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
https://bugs.ruby-lang.org/issues/14430#change-70117

* Author: carl.hoerberg (Carl Hörberg)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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. 

PR at: https://github.com/ruby/ruby/pull/1806



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:85374] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
       [not found] <redmine.issue-14430.20180201125158@ruby-lang.org>
  2018-02-01 12:51 ` [ruby-core:85324] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout carl.hoerberg
  2018-02-02  0:35 ` [ruby-core:85331] " shevegen
@ 2018-02-04 12:37 ` carl.hoerberg
  2019-11-05 13:32 ` [ruby-core:95701] [Ruby master " jean.boussier
  3 siblings, 0 replies; 5+ messages in thread
From: carl.hoerberg @ 2018-02-04 12:37 UTC (permalink / raw)
  To: ruby-core

Issue #14430 has been updated by carl.hoerberg (Carl Hörberg).


normalperson (Eric Wong) wrote:
>  
>  Unfortunately, we can't do this, yet.  The Addrinfo calls use
>  getaddrinfo(3) which doesn't support timeout natively.

Right, good catch. 

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

Looking into this i realize that /etc/nsswitch.conf has be to taken into account first. And then maybe nscd, but very few distros (if any?) install it by default anymore, and it generally seems to have a very bad rep "around the internets". 

But which one do you suggest? Go down the route of Socket.tcp, but make the DNS resolving interruptible/async (without doing it in a separate threads) or to implement thread-less timeout in the VM and continue to rely on getinfoaddr from glibc? 

----------------------------------------
Feature #14430: net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
https://bugs.ruby-lang.org/issues/14430#change-70154

* Author: carl.hoerberg (Carl Hörberg)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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. 

PR at: https://github.com/ruby/ruby/pull/1806



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:95701] [Ruby master Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
       [not found] <redmine.issue-14430.20180201125158@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-02-04 12:37 ` [ruby-core:85374] " carl.hoerberg
@ 2019-11-05 13:32 ` jean.boussier
  3 siblings, 0 replies; 5+ messages in thread
From: jean.boussier @ 2019-11-05 13:32 UTC (permalink / raw)
  To: ruby-core

Issue #14430 has been updated by byroot (Jean Boussier).


We've been recently bitten by this.

Does the merge of [#15553] makes https://github.com/ruby/ruby/pull/1806 functional?

----------------------------------------
Feature #14430: net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout
https://bugs.ruby-lang.org/issues/14430#change-82488

* Author: carl.hoerberg (Carl Hörberg)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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. 

PR at: https://github.com/ruby/ruby/pull/1806



-- 
https://bugs.ruby-lang.org/

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] 5+ messages in thread

end of thread, other threads:[~2019-11-05 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-14430.20180201125158@ruby-lang.org>
2018-02-01 12:51 ` [ruby-core:85324] [Ruby trunk Feature#14430] net/http: use Socket.tcp with connect_timeout, instead of TCPSocket.open wrapped in Timeout.timeout carl.hoerberg
2018-02-01 16:28   ` [ruby-core:85327] " Eric Wong
2018-02-02  0:35 ` [ruby-core:85331] " shevegen
2018-02-04 12:37 ` [ruby-core:85374] " carl.hoerberg
2019-11-05 13:32 ` [ruby-core:95701] [Ruby master " jean.boussier

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).