[erlang-questions] gen_tcp:connect unable to resolve hostname if network interface goes up after being initially down

Raimo Niskanen raimo+erlang-questions@REDACTED
Thu May 11 08:31:13 CEST 2017

On Thu, May 11, 2017 at 01:05:17AM +0300, Danil Zagoskin wrote:
> Hi!
> On Wed, May 10, 2017 at 5:39 PM, César Varona <cesar.varona@REDACTED> wrote:
> > lookup: [:native]
> You are using system resolver, and problems you have are likely not related
> to Erlang/OTP.
> Try {lookup, [dns, file]} instead. Use inet_db:set_lookup([dns, file]) or
> create an inetrc file.

The system resolver has on some systems got a tendency to cache resolved
hosts within the resolver library data itself, so if you restart the
process(es) that calls the resolver library it will in some cases resolve
(pun intended) the problem.

There is an undocumented feature in the native resolver that does exactly
this.  Try to call inet_gethost_native:control(soft_restart) and see if
it helps.


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list