Lukas Kirner
Lukas Kirner

Reputation: 4339

Erlang Node with non-Default EPMD port doesn't respond to ping anymore

If I start my single node application the ping succeeds on the default EPMD port 4369. If I now change the port with ERL_EPMD_PORT: 44370 to a different one I'm not able to connect to it anymore. EPMD is listening on 44370. After some debugging I found out that the following ping code halts my application due to the pang handling. I excepted pong here.

Ping Code:

net_adm:ping(TargetNode) --> pang

Note: I know that the cluster requires to use the same EPMD port to work in cluster mode. But I'm not so far in that the Node is ready to connect to others. It already halts on pinging itself. On the other hand everything works fine if the default port is used.

It seems like net_adm:ping(Host) doesn't use the env variable ERL_EPMD_PORT for pinging am I right about that? Or where could be the problem here?

Upvotes: 2

Views: 551

Answers (1)

José M
José M

Reputation: 3509

 $> epmd &     
[1] 10257
 $> epmd -names
epmd: up and running on port 4369 with data:
 $> fg
[1]  + 10257 running    epmd
^C
 $> epmd -port 44370 &    
[1] 10473
 $> epmd -names       
epmd: Cannot connect to local epmd
 $> export ERL_EPMD_PORT=44370
 $> epmd -names               
epmd: up and running on port 44370 with data:
 $> erl -sname client1@localhost                  
Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

Eshell V11.1  (abort with ^G)
(client1@localhost)1> net_adm:ping(node()).
pong
(client1@localhost)2>     

I'd verify that the local epmd is indeed listening in that port (In linux, you can use ss: ss -punta | grep 44370) and the TargetNode is properly built.

Upvotes: 3

Related Questions