[erlang-questions] Inconsistent hostnames

Oliver Korpilla Oliver.Korpilla@REDACTED
Mon Jul 11 15:08:17 CEST 2016


Hello, Raimo.

Agreed, it could cause surprises, but only on upgrading the system to a newer OTP. Wouldn't it be a bit naive to expect no changes whatsoever when doing that, anyway?

Regards,
Oliver
 

Gesendet: Montag, 11. Juli 2016 um 14:36 Uhr
Von: "Raimo Niskanen" <raimo+erlang-questions@REDACTED>
An: erlang-questions@REDACTED
Betreff: Re: [erlang-questions] Inconsistent hostnames
On Tue, Jun 21, 2016 at 07:11:54PM +0000, Ryan Stewart wrote:
> In deploying my erlang app to some new CentOS servers with erlang 18.3, I
> came across an oddity in networking. The server's networking config, which
> is admittedly messed up, looks something like:
> short hostname: bob
> long hostname: bob.prod.example.net
> domain: example.com
>
> Now when I start erlang with "erl -sname x", net_adm:localhost() returns "
> bob.prod.example.net".
>
> However, if I start erlang with "erl -name x", net_adm:localhost() returns "
> bob.example.com".
>
> I believe this comes from net_kernel:create_hostpart/2, where it follows
> different paths on short vs long node names. On a long node name, it
> appears to use short hostname + domain, where on a short node name, it
> simply uses the long hostname. That decision appears to trickle through the
> rest of the networking libraries.
>
> I understand that we need to fix the config on the server. I just wondered
> if this might be considered a bug in erlang as well.

This behaviour is old, and changing it would either surprise either some
important "short names" using application or ditto "long names" one.

For -name the Erlang networking code tries to parse the OS configuration
files e.g /etc/resolv.conf to figure out the domain name.
net_adm:localhost() then puts them together.

For -sname the Erlang networking code tries to look up the short hostname
using the native resolver to find a fully qualified alias, and takes the
domain from that.

We might call this an annoying irregularity of not very big practical
importance, probably not worth changing...

I actually do not understand why net_adm:localhost() returns the long
hostname for -sname in the first place. I think the documentation leaves
room for returning the short hostname, but changing that could probably
affect which IP address is used to contact EPMD which would surprise
some important "short names" using application.

>
> Ryan

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions


--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions[http://erlang.org/mailman/listinfo/erlang-questions]



More information about the erlang-questions mailing list