[erlang-questions] net_kernel:start() "the name seems to be in use by another Erlang node"

Mark Sebald mdsebald@REDACTED
Sun Jan 28 22:51:07 CET 2018

I am using "net_kernel:start()", to start multiple nodes of the same
application, on the same host. Each time I start a node, I don't know how
many other nodes were already started, so my thinking was to add an index
number to the node name, and if start() returns: "{already_started, pid()}"
I will increment the index on the node name, and call start() again.

Instead, when I try to start a second node of the same name I get this:

14:14:29.425 [info] Protocol 'inet_tcp': the name my_node01@REDACTED seems
to be in use by another Erlang node
14:14:29.425 [error] CRASH REPORT Process <0.109.0> with 0 neighbours
exited with reason: {error,badarg} in gen_server:init_it/6 line 349

and an error tuple is returned

This seems like an Erlang bug, since the info log message indicates that
the situation is well in hand, but then we get a crash.  Is there a better
way to start multiple nodes?  Are there any conditions where start() will
return "already_started"?

I found this from 2013:  https://github.com/elixir-lang/elixir/issues/1707,
where an Elixir user reports the same issue and Jose Valim's responds:

"I did more research on this one and unfortunately there is nothing we can
do. The error comes from within the vm, before Elixir kicks in. I will open
up a discussion with the OTP team. ..."

In the end, I  match the case where start() returns an error, and then try
starting the next node in my series, which works, but it seems rather
ugly.  I am on OTP ver. 20.x.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180128/b14f05e5/attachment.htm>

More information about the erlang-questions mailing list