Skip to content
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

Deduplicate results from getaddrinfo #11456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cjwatson
Copy link

In certain configurations it's possible to get duplicate results back from getaddrinfo: for example, if you accidentally have more than one line in /etc/hosts mapping the same name to the same IP address, then Linux/glibc systems will return multiple identical entries. This minor misconfiguration is normally harmless, but it caused this program to fail with EADDRINUSE:

require 'socket'
Socket.tcp_server_sockets('localhost', 0)

Prior to ruby/net-http#180, this caused a number of TestNetHTTP* tests to fail, as seen in these Debian bugs:

https://bugs.debian.org/1069399 (Ruby 3.1)
https://bugs.debian.org/1064685 (Ruby 3.2)
https://bugs.debian.org/1077462 (Ruby 3.3)

It's easy enough to deduplicate these.

In certain configurations it's possible to get duplicate results back
from getaddrinfo: for example, if you accidentally have more than one
line in /etc/hosts mapping the same name to the same IP address, then
Linux/glibc systems will return multiple identical entries.  This minor
misconfiguration is normally harmless, but it caused this program to
fail with `EADDRINUSE`:

    require 'socket'
    Socket.tcp_server_sockets('localhost', 0)

Prior to ruby/net-http#180, this caused a number
of `TestNetHTTP*` tests to fail, as seen in these Debian bugs:

  https://bugs.debian.org/1069399 (Ruby 3.1)
  https://bugs.debian.org/1064685 (Ruby 3.2)
  https://bugs.debian.org/1077462 (Ruby 3.3)

It's easy enough to deduplicate these.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant