Disabling IPv6 name lookups?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Disabling IPv6 name lookups?

Roger Lipscombe-2
tl;dr: how can I prevent amqp_client from using inet6?

We recently ran into a problem in our integration tests where
connecting to a RabbitMQ server on localhost was taking too long,
causing the tests to time out.

It turns out that we were bitten by a set of overlapping issues:

1. amqp_connection:start(#amqp_params_network{host = "localhost"})
attempts to resolve the name "localhost" as both IPv6 and IPv4.
2. On Ubuntu, "localhost" doesn't have an IPv4 address (you're
supposed to use "ip6-localhost").
3. We had a couple of custom search suffixes in /etc/resolv.conf.
4. One of those suffixes was configured (in dnsmasq) to forward to
another resolver that didn't exist.

This resulted in ~8 seconds for each AMQP connection, and a timeout
for the tests.

It seems that it's possible to configure amqp_client to resolve the
names using IPv4 and then IPv6, but I don't see that that's going to
make a lot of difference, since it'll still try to resolve both. It
doesn't seem to be possible to disable 'inet6' in amqp_client.

So, my question: since we're not using IPv6, is there any way to tell
Erlang (OTP-20.3.1) to globally disable the inet6 address family, and
to just insta-fail any DNS queries that use it?

erlang-questions mailing list
[hidden email]