[#66126] Creation/Conversion methods/functions table for Ruby types — SASADA Koichi <ko1@...>
Hi,
5 messages
2014/11/07
[#66248] [ruby-trunk - Feature #10423] [PATCH] opt_str_lit*: avoid literal string allocations — normalperson@...
Issue #10423 has been updated by Eric Wong.
3 messages
2014/11/13
[#66595] [ruby-trunk - Bug #10557] [Open] Block not given when the argument is a string — bartosz@...
Issue #10557 has been reported by Bartosz Kopinski.
3 messages
2014/11/30
[ruby-core:66584] [ruby-trunk - Feature #9925] rsock_addrinfo uses DNS family AF_UNSPEC for lookup causing high IPv6 AAAA volume
From:
aaron@...
Date:
2014-11-30 06:50:08 UTC
List:
ruby-core #66584
Issue #9925 has been updated by Aaron Stone.
Ping. I was hoping someone from the Ruby core would provide feedback and direction regarding my suggestions:
> There is also a compile-time Ruby flag for LOOKUP_ORDER_HACK_INET and LOOKUP_ORDER_HACK_INET6. Perhaps those could become an environment variable instead of compile-time flags?
and
> Another approach could be a module variable in Socket that I could toggle globally or per-instance. Something like this:
>
> Socket::DEFAULT_DNS_LOOKUP = :UNSPEC
>
> I could either globally set Socket::DEFAULT_DNS_LOOKUP = :INET or on a per-instance basis, e.g.
>
> my_socket = TCPSocket.new()
> my_socket.dns_lookup = :INET
----------------------------------------
Feature #9925: rsock_addrinfo uses DNS family AF_UNSPEC for lookup causing high IPv6 AAAA volume
https://bugs.ruby-lang.org/issues/9925#change-50199
* Author: Aaron Stone
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
In ext/socket/raddrinfo.c, the function `rsock_addrinfo()` always uses `AF_UNSPEC` for DNS queries. This is causing me a very high volume of IPv6 DNS lookups. `rsock_addrinfo()` is used by TCPSocket (and all other Socket base classes, e.g. Socket and UDPSocket), and TCPSocket is used by Net::HTTP.
Remember that DNS does not do negative caching - if a hostname does not have a AAAA record, then DNS will _always_ try to look up that record again!
I propose that the following code should have some way to force IPv4 or IPv6 lookups:
http://rxr.whitequark.org/mri/source/ext/socket/raddrinfo.c
~~~c
378 struct addrinfo*
379 rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
380 {
381 struct addrinfo hints;
382
383 MEMZERO(&hints, struct addrinfo, 1);
384 hints.ai_family = AF_UNSPEC;
385 hints.ai_socktype = socktype;
386 hints.ai_flags = flags;
387 return rsock_getaddrinfo(host, port, &hints, 1);
388 }
~~~
For example, an environment variable named something like `RUBY_GAI` could be set to "INET" or "INET6" to switch the `hints.ai_family` away from `AF_UNSPEC`.
--
https://bugs.ruby-lang.org/