Repository navigation
Fix AsyncAuth AttributeError on _creds race with creds_map (#67947) - #69666
Merged
Merged
Conversation
AsyncAuth.__singleton_init__ only assigned self._creds when the key was
already in the class-wide creds_map. When it was not, __init__ fell
through to self.authenticate() and left _creds unset. If a sibling
AsyncAuth for the same key (same pki_dir + id + master_uri +
key-mtime tuple) completed its sign_in between our construction and
our _authenticate reaching the `if key not in AsyncAuth.creds_map:`
check, the coroutine took the else branch and dereferenced
self._creds["aes"], raising
AttributeError: 'AsyncAuth' object has no attribute '_creds'
That crash aborted the authenticate coroutine mid-flight, so
_authenticate_future never resolved, the minion's connection to the
master silently died, and running jobs continued to publish results
into the void until manual restart. It reproduced most often on
multi-master failover minions where several AsyncAuth instances race
for the same key.
Initialize self._creds = None in __singleton_init__ (matching the
sibling SAuth.__init__) and treat `self._creds is None` as the
first-authentication case in _authenticate, so the else branch is only
entered when we have prior creds to compare against.
Fixes saltstack#67947
twangboy
approved these changes
Jul 9, 2026
This branch was previously deployed
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?
Initializes
AsyncAuth._credsin__singleton_init__(matching thesibling
SAuth.__init__) and treatsself._creds is Noneas thefirst-authentication case in
_authenticate, closing a race that couldraise
AttributeError: 'AsyncAuth' object has no attribute '_creds'andsilently sever a minion's master connection.
What issues does this PR fix or reference?
Fixes #67947
Previous Behavior
When
AsyncAuth.__singleton_init__ran with the auth key absent from theclass-wide
creds_map, it fell through toself.authenticate()and leftself._credsunset. If a siblingAsyncAuthfor the same key (samepki_dir+id+master_uri+ key-mtime tuple) completed its ownsign_in between our construction and our
_authenticatereaching theif key not in AsyncAuth.creds_map:check, the coroutine took the elsebranch and dereferenced
self._creds["aes"]:The exception aborted the coroutine mid-flight,
_authenticate_futurenever resolved, and the minion's channel to the master silently died.
Running jobs kept publishing results that went nowhere until the minion
was restarted. Reproduced by the reporter on Windows 3006.8 multi-master
failover minions.
New Behavior
self._creds = Noneis set at the top of__singleton_init__so_authenticatecan safely inspect it, and the else-branch guard becomesif key not in AsyncAuth.creds_map or self._creds is None:— a racedcreds_mapinsert during our sign_in is now handled as a normalfirst-authentication rather than crashing.
Merge requirements satisfied?
changelog/67947.fixed.md)tests/pytests/unit/test_crypt.py::test_authenticate_missing_creds_attribute_67947)Commits signed with GPG?
No (matching the rest of 3006.x history).