[erlang-questions] Weird issue with global names

Jon Butler <>
Sun Jan 3 19:30:10 CET 2016


Hi All,

Disclaimer - I'm new to erlang, this may be a "stupid" question. I have at
least read the docs :)

I'm seeing some (possibly) odd behavior trying to use global names between
two instances of the erlang shell on the same node. The code I am currently
testing is 99% rebar boilerplate at the moment, so I won't bore you with
lines of template code unless it's asked for.

My setup is that I have an application with a supervisor, and a number of
gen_servers that run under that supervisor. I have modified one of the
gen_servers to register globally (using the {global, Name} method), and can
confirm in the init method that the chosen name is present in the output of
global:registered_names().

I then run a second application on the same node that calls
net_kernel:connect to the previous node, which returns successfully.
However, I am not able to see the globally registered name I just setup in
the output of global:registered_names() on this node.

I also notice that if I do not provide the "-noshell" argument when
starting the first application, running global:registered_names() in the
shell gives an empty list even though the application ran and registered
the name successfully.

Simple examples of global name registration between two shells (not running
applications) on the same node work fine.

Am I missing something?

Thanks,
Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160103/40184172/attachment.html>


More information about the erlang-questions mailing list