ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: mohamed.m.m.hafez@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:102063] [Ruby master Feature#17528] Make Addrinfo.getaddrinfo fall back to Timeout.timeout for :resolv_timeout
Date: Wed, 13 Jan 2021 16:05:12 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-89924.20210113160511.10980@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17528.20210111205333.10980@ruby-lang.org

Issue #17528 has been updated by mohamedhafez (Mohamed Hafez).


According to https://bugs.ruby-lang.org/issues/12435, the only reason we are using `Timeout.timeout` in `Net::HTTP#connect` instead of using nonblocking io and `IO.select` is so that we can place a timeout on the getaddrinfo function, @normalperson can you clarify here?

----------------------------------------
Feature #17528: Make Addrinfo.getaddrinfo fall back to Timeout.timeout for :resolv_timeout
https://bugs.ruby-lang.org/issues/17528#change-89924

* Author: mohamedhafez (Mohamed Hafez)
* Status: Open
* Priority: Normal
----------------------------------------
Currently, `Addrinfo.getaddrinfo` ignores the `:resolv_timeout` option if we are on a system without `getaddrinfo_a`. It would be great if instead it would fall back to using `Timeout.timeout`.

That way, we could get rid of a lot of the usage of `Timeout.timeout` for systems that *do* have `getaddrinfo_a`. For example, for Net::HTTP#connect we could easily then do something like this: https://github.com/ruby/ruby/compare/master...mohamedhafez:patch-3?diff=split.

The motivation for this is that the usage of Timeout.timeout is inherently unsafe, and it would be great to stop using it where we can (see https://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/ and http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html)  



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

  parent reply	other threads:[~2021-01-13 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 20:53 [ruby-core:102005] [Ruby master Feature#17528] Make Addrinfo.getaddrinfo fall back to Timeout.timeout for :resolv_timeout mohamed.m.m.hafez
2021-01-12  4:57 ` [ruby-core:102015] " akr
2021-01-13 16:05 ` mohamed.m.m.hafez [this message]
2021-01-13 17:50 ` [ruby-core:102069] " akr
2021-01-13 20:50 ` [ruby-core:102072] " mohamed.m.m.hafez

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