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

Dave Cottlehuber dch@REDACTED
Sun Jul 5 21:48:10 CEST 2015


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



More information about the erlang-questions mailing list