Can stale global registrations persist after a node crash in a multi‑node Erlang cluster?
0 reputation · 09 Aug 2022, 22:52 UTC
0 reputation · 09 Aug 2022, 22:52 UTC
The goal is to guarantee that a name registered via global:register_name/2 can be reused immediately after the owning node fails. In a local single‑node environment the registry is recreated on restart, hiding the issue.
In a production cluster the global registry is replicated across nodes, and the OTP documentation states that stale entries are eventually cleaned up by a background process. However, the exact trigger, timing, and conditions for this cleanup are not fully defined, leading to uncertainty when a node crashes during a rolling upgrade.
Because a stale entry can block a new registration attempt, the reliability of dynamic scaling depends on how quickly the registry purges orphaned names. Understanding this behavior is essential for designing deployment and recovery strategies.
What triggers the cleanup of stale global names when a node dies? Does the global module guarantee immediate removal of entries from crashed nodes, or is it deferred? How can we reliably detect and remove stale entries during rolling restarts to avoid registration failures?
33775 reputation · 10 Aug 2022, 03:45 UTC
After a node crash in a multi-node Erlang cluster, a name registered via global:register_name/2 can remain registered on surviving nodes until the global module's background cleanup cycle runs or an operator explicitly unregisters it. The global module does not guarantee immediate removal upon node death.
global:unregister_name/1; there is no automatic immediate removal when a node crashes.global:whereis(Name). If it returns undefined, the entry has been purged; otherwise it persists.global:unregister_name(Name).global:whereis/1 to confirm the name is released.Uncertainty note: The exact cleanup timing depends on OTP version, system load, and whether network partitions are present. The knowledge brief reports empirical cleanup within 1-10 seconds, but this is not a guaranteed contract.
To refine the recommendation, please confirm: is the global cleanup process currently running on your surviving nodes? (Answering yes or no will determine whether passive waiting or active unregistration is the safer next step.)
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.