Repository navigation
Conversation
Observed on the 24-master clustered sandbox: every
CLI publish failed with::
SaltClientError: 'jid'
Trace:
File "salt/client/__init__.py", line 2162, in pub
return {"jid": payload["load"]["jid"],
"minions": payload["load"]["minions"]}
KeyError: 'jid'
### Root cause
ReqServerChannel.handle_message at salt/channel/server.py:452
short-circuits with::
{"enc": "clear", "load": {"ret": False,
"cluster_retry": True}}
when _cluster_is_ready() is False (Raft not yet a committed
voter / leadership flapping). No jid key in the load. The
minion-side AsyncReqChannel._crypted_transfer knows about the
cluster_retry sentinel (salt/channel/client.py:253-266),
but LocalClient.pub / pub_async do not -- they both end
with::
return {"jid": payload["load"]["jid"],
"minions": payload["load"]["minions"]}
which KeyErrors on the missing jid. cmd_async then
re-raises as SaltClientError: 'jid', which tells the operator
nothing about the real condition.
The cluster_retry sentinel was introduced in commit
97d78d3 (May 2026, "consensus: gate minion/CLI traffic
until node is a committed Raft voter"). Gate was never taught to
the LocalClient publish path.
### Fix
LocalClient.pub and LocalClient.pub_async now detect the
cluster_retry key in the returned load and raise::
SaltClientError(
"Master is not ready; cluster consensus still forming. "
"Retry the command once the cluster is ready."
)
### Follow-up flagged, not in this commit
Secondary gate-latch bug: MasterPubServerChannel._signal_cluster_ready
installs a one-shot on_ready callback on the RaftService. When
RaftService restarts (observed on topo-west-1 across terms 6-9),
the callback never re-arms and the gate latches closed
permanently. Needs separate fix (re-arm on RaftService restart,
or switch from one-shot to continuous).
### Regression test
tests/pytests/unit/client/test_init.py::test_pub_raises_clean_error_on_cluster_retry: mocks the
ReqChannel to return the cluster_retry payload shape and
asserts SaltClientError("cluster consensus still forming")
is raised (not KeyError('jid')). Verified FAIL pre-fix /
PASS post-fix.
Pre-commit black hook flagged this file during CI; running the hook locally and committing the reformat.
3 tasks done
Contributor
Author
|
Superseded by #70755 which combines all five cluster-correctness backports into a single PR. |
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.
Summary
Backport from master-topology work (
LocalClientportion only; theRemoteClientcompanion fix depends on master-only PR #70656 and will follow once that lands on 3008.x).When Raft is still forming on a clustered master,
_cluster_is_readyreturnsFalseand the receiver returns{"enc": "clear", "load": {"ret": False, "cluster_retry": True}}with nojidkey.LocalClient.pub/pub_asyncpreviously crashed withKeyError: 'jid'(wrapped bycmd_asyncas the opaqueSaltClientError: 'jid'), confusing operators who were just hitting a cold-start race.Fix: receive path detects the
cluster_retrysentinel and raises a cleanSaltClientErrorwith an actionable message telling the operator the cluster is still forming and to retry.Test plan
pytest tests/pytests/unit/client/ tests/pytests/unit/test_client.py— 242 passed, 12 skipped