[3008.x] Fix minion PublishServer / _TCPPubServerPublisher unclosed leaks (#70175) - #70206
Open
dwoz wants to merge 1 commit into
Open
[3008.x] Fix minion PublishServer / _TCPPubServerPublisher unclosed leaks (#70175)#70206dwoz wants to merge 1 commit into
dwoz wants to merge 1 commit into
Conversation
…utdown MinionManager.destroy() (invoked from cli.daemons.Minion.shutdown on KeyboardInterrupt / SaltSystemExit / early-exit and from __del__ on GC) was missing the close/destroy chain for the local event_publisher PublishServer graph and the event SaltEvent that MinionManager._bind creates. Only the SIGTERM stop_async path closed them, so any non-SIGTERM shutdown leaked the graph and surfaced the three-warning cascade reported in saltstack#70175 (unclosed publish server / SyncWrapper / publisher client).
twangboy
approved these changes
Sep 1, 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.
Symptom
Issue #70175: three ResourceWarnings fire at minion shutdown
Root cause
MinionManager._bindcreates the localevent_publisher(aPublishServergraph) andevent(aSaltEvent). OnlyMinionManager.stop_async(the SIGTERM handler path) closes them.MinionManager.destroy-- reached fromcli.daemons.Minion.shutdownonKeyboardInterrupt/SaltSystemExit/ early-exit guards, and from__del__on GC -- did not, so any non-SIGTERM shutdown leaked the graph.Fix
Add the missing close/destroy chain to
MinionManager.destroy, guarded with try/except so a finalizer never propagates.Test plan
test_minion_manager_destroy_closes_event_publisherintests/pytests/unit/test_minion.pyassertsdestroy()closesevent_publisher(_closing=True) and destroysevent(subscriber/pusher cleared). Verified to fail against unfixed 3008.x and pass with the fix.test_minion_manager_async_stop/test_stop_async_calls_notify_stopping_and_terminates_subprocess_liststill pass.tests/pytests/unit/test_minion.py: 50 passed, 28 skipped.