-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JRuby Addrinfo.addrinfo
does not match MRI Ruby or system sort order
#4594
Comments
This appears to be Java behavior. We simply use You can set a JVM property `java.net.preferIPv6Addresses=true" to get the behavior you're looking for.
Here's a page detailing this and other configs and the justification (backwards compatibility) for the IPv4 preference: https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html |
I'm closing this as Won't Fix because we're just projecting Java behavior here. If you think there's something more we should be doing, we can discuss it. |
@headius thanks for taking the time to look at this issue! |
I am the author of the downstream ticket. I understand that the root cause of this issue is a setting in Java. A setting I believe has an incorrect default value, but I wont try to correct that, as it is probably not going to happen. However, is this perhaps something we can and perhaps should fix in JRuby? Let me start by saying I don't know if JRuby tries to be identical to regular Ruby in regard to code output, or if i should see JRuby as a separate project that is only related to regular Ruby. So I do not know if the difference in output of Ruby vs JRuby is an issue or not. However, the setting in Java can be changed runtime: Is that something JRuby would consider? By setting this value to true, it complies to the documentation which states IPv6 should come first, as described here: https://apidock.com/ruby/v1_8_7_72/Socket/getaddrinfo/class (third bullet) |
RFC 6724 indicates that by default ipv6 addresses should be sorted before ipv4 addresses. On Linux getaddrinfo(3) documents that "The sorting function used within getaddrinfo() is defined in RFC 3484; the order can be tweaked for a particular system by editing /etc/gai.conf (available since glibc 2.5)." (RFC6724 superceded RFC3484.)
Using the system resolution on an IPv6 enabled host via
getent
matches this behavior, as does Ruby 2.1.5, but JRuby does not match this behavior.Downstream ticket: https://tickets.puppetlabs.com/browse/SERVER-1801
Environment
In this scenario
/etc/gai.conf
is the default that ships with Debian 8.Desired ordering
Test script
Expected Behavior
The ordering of
Addrinfo.getaddrinfo
should respect the ordering given by/etc/gai.conf
and match the behavior of MRI ruby.Using the system Ruby on Debian 8:
Actual Behavior
The text was updated successfully, but these errors were encountered: