[erlang-questions] Strange inet_gethost_native:gethostbyname behavior

Raimo Niskanen raimo+erlang-questions@REDACTED
Fri Jan 26 09:37:00 CET 2018

On Thu, Jan 25, 2018 at 09:59:16AM -0800, David Welton wrote:
> Hi,
> Thanks...
> >> inet_gethost_native:gethostbyname("google.com", inet). kept failing
> >> with {error, try_again}.
> >> Any ideas what 1) may cause this and 2) how to get around it?  The
> >> system is stuck not being able to do DNS lookups, which is
> >> problematic, to say the least.
> > It happens that libc in a native resolver process caches DNS replies for
> > too long, maybe after some network reconfiguration, and this call
> > restarts all native resolver processes the node uses.
> Seems odd, though, that things are unable to recover.  I wonder what
> might cause that.

One thing that has caused this in the past is reconfiguring the DNS
resolver for the machine.  Then the erlang node can have cached negative
responses with long lifetime, but the DNS reconfiguration was intended to
fix those negative responses.

And libc can not do better than using the lifetime of the negative
responses it got.  So the situation will probably recover, but it might
take a week...

> -- 
> David N. Welton
> http://www.welton.it/davidw/
> http://www.dedasys.com/


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list