You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EventStore.Notifications.Supervisor process is named using :global to ensure only a single instance runs, regardless of how many nodes are connected when using distributed Erlang. This is because there should be only one process listening and publishing events to subscriptions.
When a node joins a cluster there will be a name clash and one process, at random, will be terminated. See register_name/2 in :global docs for details.
This results in error messages on one node due to the exited supervisor process and its children. These messages do not need to be treated as errors.
On Node A:
[info] global: Name conflict terminating {EventStore.Notifications.Supervisor, #PID<15777.550.0>}
Instead of logging an error it would be preferable to shutdown one of the duplicate processes with a normal exit. :global supports other exit strategies, such as notify instead of exit. Unfortunately Elixir’s use of :global for GenServer name registration doesn’t allow specifying the strategy.
It would be possible to write a wrapper module for forward the calls to :global and also provide the resolve function (using {:via, EventStore.GlobalProxy, name}).
defmoduleEventStore.GlobalProxydodefregister_name(name,pid)do:global.register_name(name,pid,&resolve/3)enddefpresolve(name,pid1,pid2)do# Shutdown one process to resolve name clashendend
The text was updated successfully, but these errors were encountered:
The
EventStore.Notifications.Supervisor
process is named using:global
to ensure only a single instance runs, regardless of how many nodes are connected when using distributed Erlang. This is because there should be only one process listening and publishing events to subscriptions.When a node joins a cluster there will be a name clash and one process, at random, will be terminated. See
register_name/2
in:global
docs for details.This results in error messages on one node due to the exited supervisor process and its children. These messages do not need to be treated as errors.
On Node A:
On Node B:
Instead of logging an error it would be preferable to shutdown one of the duplicate processes with a normal exit.
:global
supports other exit strategies, such as notify instead of exit. Unfortunately Elixir’s use of:global
for GenServer name registration doesn’t allow specifying the strategy.It would be possible to write a wrapper module for forward the calls to
:global
and also provide the resolve function (using{:via, EventStore.GlobalProxy, name}
).The text was updated successfully, but these errors were encountered: