[erlang-questions] epmd behind firewall prevents observer starting up quickly

Raimo Niskanen raimo+erlang-questions@REDACTED
Thu Jul 9 12:28:55 CEST 2015


This seems like a bug.  I understand why net_adm:localhost() returns the
external name since it is supposed to give you a canonical name, and it is
documented so.  But I do not understand why the node does not communicate
with the local EPMD over the loopback interface, which should be logical.

We should correct this.

/ Raimo Niskanen, Erlang/OTP



On Sun, Jul 05, 2015 at 09:48:10PM +0200, Dave Cottlehuber wrote:
> I use observer quite a bit, but when I start it in distributed node it
> takes ~80 seconds to start up, on 1 computer only that has a valid
> DNS-resolvable hostname but is sensibly firewalled.
> 
> > time erl -s observer -sname foo
> 
> ^C
> 
> 0.85s user 0.24s system 1% cpu 1:19.43 total
> 
> turns out that inside observer_wx.erl it calls (finally)
> erl_epmd:names/1 which times out, even though epmd is running &
> available on the right port.
> 
> > epmd -d -d -d &
> epmd: Sun Jul  5 21:34:20 2015: epmd running - daemon = 0
> epmd: Sun Jul  5 21:34:20 2015: try to initiate listening port 4369
> epmd: Sun Jul  5 21:34:20 2015: entering the main select() loop
> 
> > erl -sname foo
> 
> erl_epmd:names(net_adm:localhost()). %% hangs
> 
> https://github.com/erlang/otp/blob/master/lib/kernel/src/erl_epmd.erl#L426-L432
> 
> The issue appears to be that net_adm:localhost() returns the hostname
> for this computer, which resolves to its NATted external IP, which is
> sensibly blocked from receiving external traffic for epmd's port range,
> and therefore the function times out as the socket fails to connect.
> 
> > erl -name foo
> Erlang/OTP 18 [erts-7.0.1] [source] [64-bit] [smp:4:4]
> [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
> 
> Eshell V7.0.1  (abort with ^G)
> (foo@REDACTED)1> nodes().
> []
> (foo@REDACTED)2> net_adm:ping('shell@REDACTED').
> pong
> (foo@REDACTED)3> nodes().
> ['shell@REDACTED']
> (foo@REDACTED)4>  erl_epmd:open({9,1,1,1}). %% changed to
> protect the innocent
> {error,etimedout}
> (foo@REDACTED)5>  erl_epmd:open({127,0,0,1}).
> {ok,#Port<0.760>}
> (foo@REDACTED)6>
> 
> observer eventually works correctly after the 60+ timeout, but I'd like
> to know if there's any way to work around this? I'm hesitant to call it
> a bug, but it does seem reasonable for observer & other tools to work on
> systems that have FQDN set and are behind firewalls.
> 
> A+
> Dave
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list