Tear down deltaproxy sub-proxies on shutdown (#70221) - #70222
Open
ggiesen wants to merge 1 commit into
Open
Conversation
A deltaproxy builds its sub-proxies into self.deltaproxy_objs during post_master_init and nothing in the shutdown path ever touched that dict again. ProxyMinion had no destroy() of its own, so it inherited Minion.destroy(), which tears down only the instance it is called on. Each sub-proxy is a full ProxyMinion with its own req_channel, schedule, beacons and periodic callbacks, and all of those were abandoned on every stop or restart. Give ProxyMinion a destroy() that tears down the sub-proxies first and then itself. One sub-proxy failing does not stop the others or the control proxy's own teardown, and a single proxy with no sub-proxies is unaffected.
twangboy
approved these changes
Sep 2, 2026
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.
What does this PR do?
Makes a deltaproxy tear down its sub-proxies when it stops.
What issues does this PR fix?
Fixes #70221
Root cause
post_master_initbuilds the sub-proxies intoself.deltaproxy_objs, and nothing in the shutdown path ever touches that dict again.salt.minion.ProxyMinionhad nodestroy()of its own, so it inheritedMinion.destroy(), which tears down only the instance it is called on. Each sub-proxy is a fullProxyMinionwith its ownreq_channel, schedule, beacons and periodic callbacks, so all of those were abandoned on every stop or restart.Previous Behavior
A
SIGTERMto a deltaproxy hosting three sub-proxies produced exactly one teardown:New Behavior
Merge requirements satisfied?
Tests written?
Yes, three in
tests/pytests/unit/test_minion.py: sub-proxies are torn down and the control proxy still tears itself down afterwards; one sub-proxy raising does not stop the others or the control proxy; and a single proxy with nodeltaproxy_objsis unaffected. The first two fail against unmodified 3008.x.Verified against a live deltaproxy on 3008.2 with three sub-proxies, where
destroy()calls went from 1 to 4 in the order above.One note on reproducing: this is only observable once the proxy actually reaches its teardown. On an unpatched 3008.2 the daemon exits before the scheduled graceful shutdown runs at all, which is #70217 / #70218, so that fix needs to be in place first or nothing is torn down regardless. The two are independent changes.
A related question, deliberately not addressed here
While tracing this I noticed the proxymodule's own
shutdown()is never invoked on daemon stop for any proxy, not just sub-proxies -- the only callers anywhere insalt/aresalt/modules/junos.pyandsalt/modules/status.py. So a proxymodule that opens a device session has no teardown hook salt itself calls when the daemon stops.That may be deliberate, and changing it would alter behaviour for every proxy deployment rather than just deltaproxy, so this PR does not touch it. Raised in #70221 in case it is not intentional, and happy to follow up separately if you want it changed.
Commits signed with GPG?
No