Skip to content

Fix ZMQ REQ identity collisions causing 60s salt-call hangs (backport #69920 to 3006.x) - #70196

Open
jzandbergen wants to merge 1 commit into
saltstack:3006.xfrom
jzandbergen:backport/69920-3006x
Open

Fix ZMQ REQ identity collisions causing 60s salt-call hangs (backport #69920 to 3006.x)#70196
jzandbergen wants to merge 1 commit into
saltstack:3006.xfrom
jzandbergen:backport/69920-3006x

Conversation

@jzandbergen

Copy link
Copy Markdown
Contributor

Summary

Backports upstream commit 098e4be
("zeromq: per-instance UUID IDENTITY for daemon AsyncReqMessageClient
(#69920)") from master to 3006.x.

Problem

3006.27 introduced a stable ZMQ IDENTITY for the AsyncReqMessageClient
REQ socket used by long-lived minion/syndic daemons. A running
salt-minion daemon and a one-off salt-call invocation both set
opts["__role"] = "minion" and share the same minion_id, so they end
up requesting the same IDENTITY. This causes the master's ROUTER
socket to drop replies for one of the two clients, resulting in
requests stalling for the full ~60s REQUEST_TIMEOUT before retrying.

See #70127 for the full report and root-cause analysis.

Fix

Each AsyncReqMessageClient now generates a per-instance
uuid.uuid4().hex as its ZMQ IDENTITY instead of relying on a
process-wide counter (_REQ_IDENTITY_SLOT / SALT_REQ_IDENTITY_SLOT_MAX).
Since every RequestClient is opened and closed by Salt itself, a
per-instance UUID matches the object's lifetime 1:1, so concurrent
salt-call and salt-minion processes (or any other short-lived
clients) can no longer collide on the same identity, regardless of
role or minion ID.

Testing

  • Cherry-picked cleanly onto 3006.x with one trivial import-order
    conflict in salt/transport/zeromq.py (unrelated zlib import from
    master history was dropped; not present on 3006.x).
  • Includes the upstream unit tests
    (tests/pytests/unit/transport/test_zeromq_identity_uuid.py) and
    updated existing tests in test_zeromq.py.

Fixes #70127

…altstack#69920)

Give each daemon AsyncReqMessageClient a per-instance uuid.uuid4().hex
as its ZMQ IDENTITY, replacing the earlier process-wide
_REQ_IDENTITY_SLOT counter and SALT_REQ_IDENTITY_SLOT_MAX cap.  Each
RequestClient is opened and closed by Salt itself, so a per-instance
UUID matches the object's lifetime and gives the master ROUTER's
routing-id table a 1:1 mapping to a client we control.  Fork
inheritance of the earlier counter -- root cause of saltstack#69753 -- is
impossible by construction, since each child draws a fresh UUID.

(cherry picked from commit 098e4be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: salt-call causes ~60s hangs on minions due to ZMQ identity collision with running salt-minion daemon (3006.27 regression)

3 participants