Prevent federation links from restarting during node shutdown (backport #15258)#15264
Merged
michaelklishin merged 4 commits intov4.2.xfrom Jan 14, 2026
Merged
Prevent federation links from restarting during node shutdown (backport #15258)#15264michaelklishin merged 4 commits intov4.2.xfrom
michaelklishin merged 4 commits intov4.2.xfrom
Conversation
or plugin shutdown, for that matter. With this guardrail in place, nodes with hundreds or thousands of federation links will avoid potentially significant shutdown delays that have to do with links being restarted while the node as a whole is preparing to shut down. Per discussion with @dcorbacho @ansd. (cherry picked from commit adc25bb)
This avoids a classic deadlock in Erlang: when an application_controller (AC) invokes a callback, such as pre_stop/1, the function invoked cannot use any OTP functions that would ultimately require an AC response. application:set_env/2 is one of such functions, so with this commit we switch to a persistent term. (cherry picked from commit a8347b2)
(cherry picked from commit 80c8d7b)
(cherry picked from commit a3b547b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
or plugin shutdown, for that matter.
With this guardrail in place, nodes with hundreds or thousands of federation links will avoid potentially significant shutdown delays that have to do with
links being restarted while the node as a whole is preparing to shut down.
This state is node-local, as is the shutdown state, so this will not prevent links migrating between nodes (under
mirrored_supervisor) from starting.Per discussion with @dcorbacho @ansd.
Note that this PR cannot be backported exactly to
v4.1.xand earlier branches. The federation plugin split inmainfirst shipped in4.2.0.This is an automatic backport of pull request #15258 done by Mergify.