Skip to content

[Bug]: Master cluster (isolated filesystem) behind a load balancer: "Master did not return a session key for pillar request" #70399

Closed

Description

@k-hamza

What happened?

Description

We are evaluating a 3-node master cluster on Salt 3008.3 with cluster_isolated_filesystem: True, each master having its own local cluster_pki_dir.

Behind a TCP load balancer (haproxy) without session affinity, minions consistently fail to fetch their pillar. Each master works fine when the minion is pointed at it directly.

We have a hypothesis about the cause, but we have not instrumented the code, so it is only a lead.

Transparency note: the tests and observations below were carried out by us on our own environment. The code reading and the resulting hypotheses were produced with the help of an AI assistant (Claude, via GitHub Copilot), and have not been verified beyond what is described here. They may contain inaccuracies, and we would be grateful for any correction.

Setup

  • Salt 3008.3, 3 masters, cluster_isolated_filesystem: True
  • HAProxy in front of 4505 / 4506, mode tcp, balance roundrobin
  • Minion 3008.3 configured with master: <VIP>
  • Minion key accepted on all three masters
  • cluster_pki_dir/.aes and cluster.pub identical on the three masters
id: <ip_node_1>
cluster_id: salt_master_cluster
cluster_peers:
  - <ip_node_2>
  - <ip_node_3>
cluster_secret: <secret>
cluster_pool_port: 4520
cluster_isolated_filesystem: True
cluster_pki_dir: /var/lib/salt/cluster_pki
interface: <ip_node_1>

What we observe

Through the load balancer, every salt-call test.ping fails with:

[ERROR   ] Master did not return a session key for pillar request
Exception getting pillar.

Pointing the minion directly at any single master works: salt-call test.ping returns True on each of the three.

On the masters, cachedir/sessions/<minion_id> exists on each node with a different content. After deleting it on all nodes and running salt-call again through the VIP, the file reappears on all three nodes, again with three different contents.

Expected behavior

The minion should be able to authenticate on one peer and send subsequent requests to any other peer.

A possible lead, offered tentatively

(AI-assisted code reading, see the transparency note above.)

With request protocol v3, our understanding is that the minion encrypts its requests with a per-minion session key received in the _auth reply. On the master side, that key appears to be read from cachedir:

salt/salt/master.py

Lines 3913 to 3927 in 92bfd74

path = pathlib.Path(self.opts["cachedir"]) / "sessions" / minion
# Fast-path cache hit: single read of ``self.sessions[minion]``.
# Serialise the check-then-return sequence so a concurrent write
# can't leave us with a torn tuple. The lock is only held over
# the dict access and the (cheap) mtime stat.
with self._sessions_lock:
cached = self.sessions.get(minion)
if cached is not None:
if now - cached[0] < self.opts["publish_session"]:
# Master cluster deployments share ``sessions/<minion>``
# on a shared filesystem so a peer master's rotation must
# invalidate our in-memory cache. Comparing the file
# mtime against the mtime we cached catches that case
# without penalising the single-master fast path -- the
# ``stat`` is cheap and only runs on cache hits.

path = pathlib.Path(self.opts["cachedir"]) / "sessions" / minion

The comment in ReqServerChannel.session_key() seems to assume a shared filesystem:

# Master cluster deployments share ``sessions/<minion>``
# on a shared filesystem so a peer master's rotation must
# invalidate our in-memory cache.

We could not find an equivalent replication path for this directory in isolated-filesystem mode (unlike minion keys, roots, or the job cache), but we may simply have missed it.

If there is none, the sequence could be:

  1. _auth is routed to master A, and the minion receives session key S_A.
  2. _pillar is routed to master B, which decrypts with its own S_B and returns "bad load".
  3. The response has no "key" field, and the minion raises the error above.

This would match the fact that the files differ between nodes, and that they are regenerated on all three nodes when the minion retries through the VIP.

Type of salt install

Official rpm

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

rhel-9

salt --versions-report output

Salt Version:
          Salt: 3008.3

Python Version:
        Python: 3.14.7 (main, Sep 30 2026, 03:35:11) [GCC 11.2.0]

Dependency Versions:
          cffi: 2.0.0
      cherrypy: 18.10.0
  cryptography: 50.0.1
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: 4.0.12
     gitpython: 3.2.0
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.2.1
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 3.00
      pycrypto: Not Installed
  pycryptodome: 3.23.0
        pygit2: Not Installed
  python-gnupg: 0.5.6
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: 0.22.27
         smmap: 5.0.2
       timelib: 0.3.0
       Tornado: 6.5.10
           ZMQ: 4.3.5

Salt Package Information:
  Package Type: onedir

System Versions:
          dist: rhel 9.7 Plow
        locale: utf-8
       machine: x86_64
       release: 5.14.0-687.44.1.el9_8.x86_64
        system: Linux
       version: Red Hat Enterprise Linux 9.7 Plow

Activity

  1. added
    bug
    on Oct 13, 2026
  2. welcome commented on Oct 13, 2026

    @welcome

    Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
    Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

    There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
    If you have additional questions, email us at [email protected]. We're glad you've joined our community and look forward to doing awesome things with you!

  3. added
    severity-critical
    and removed on Oct 17, 2026
  4. dwoz commented on Oct 30, 2026

    @dwoz
    Contributor

    Closing as completed — implemented by merged PR #70429.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugseverity-critical

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions