Skip to content

[BUG] intermittent connection between master and minion #65265

Closed

Description

@qianguih

Description
A clear and concise description of what the bug is.
I am seeing a weird connection issue in my salt setup. there are ~30 minions registered with the master. for a few of them, master couldn't connect to them anymore after a while. salt '*' test.ping failed with the following error message:

    Minion did not return. [No response]
    The minions may not have all finished running and any remaining minions will return upon completion. To look up the return data for this job later, run the following command:
    
    salt-run jobs.lookup_jid 20230920213139507242

here are a few observations:

  • restarting the salt-minion service helped but the same minion lost connection again after a while.
  • salt-call test.ping works fine on minion side. other commands like salt-call state.apply also works fine. this indicates minion to master communication is fine but master to minion communication is not
  • below is the error message i found from minion log. i tried to bump up the timeout param like salt '*' -t 600 test.ping . but it doesn't help
2023-09-20 13:00:08,121 [salt.minion      :2733][ERROR   ][821760] Timeout encountered while sending {'cmd': '_return', 'id': 'minion', 'success': True, 'return': True, 'retcode': 0, 'jid': '20230920195941006337', 'fun': 'test.ping', 'fun_args': [], 'user': 'root', '_stamp': '2023-09-20T19:59:41.114944', 'nonce': '3b23a38761fc4e98a694448d36ac7f97'} request

Does anyone have any idea what's wrong here and how to debug this issue?

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

  • minion was installed by sudo ./bootstrap-salt.sh -A <master-ip-address> -i $(hostname) stable 3006.3. no custom config on minion
  • master runs inside a container using image saltstack/salt:3006.3 . master configs:
nodegroups:
  prod-early-adopter: L@minion-hostname-1
  prod-general-population: L@minion-hostname-2
  release: L@minion-hostname-3
  custom: L@minion-hostname-4

file_roots:
  base:
    - <path/to/custom/state/file>

state file:

pull_state_job:
  schedule.present:
    - function: state.apply
    - maxrunning: 1
    - when: 8:00pm

deploy:
  cmd.run:
    - name: '<custom-command-here>'
    - runas: ubuntu

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.3
 
Python Version:
        Python: 3.10.4 (main, Apr 20 2022, 01:21:48) [GCC 10.3.1 20210424]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: Not Installed
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: alpine 3.14.6 
        locale: utf-8
       machine: x86_64
       release: 5.11.0-1022-aws
        system: Linux
       version: Alpine Linux 3.14.6 

Additional context
Add any other context about the problem here.

Activity

  1. added
    bug
    on Sep 21, 2023
  2. welcome commented on Sep 21, 2023

    @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. brettgilmer commented on Dec 21, 2023

    @brettgilmer

    HI - I am seeing this same issue.
    I am also seeing on the periodic pings configured by the "ping_interval" minion configuration parameter.
    Running salt 3006.5 on both minon and master.

  4. darkpixel commented on Dec 22, 2023

    @darkpixel
    Contributor

    It seems worse with 3006.5 with Linux as the master when managing Windows minions.

  5. brettgilmer commented on Dec 26, 2023

    @brettgilmer

    This is affecting many of our endpoints. I can get them to re-establish communication by restarting the minion or the master, but they lose communication again.

  6. brettgilmer commented on Dec 28, 2023

    @brettgilmer

    Restarting the saltmaster seems to fix the issue for all minions, for a while, but the issue will return after about 12 hours on a different seemingly random selection of minions.

  7. raddessi commented on Jan 25, 2024

    @raddessi
    Contributor

    I seem to have a very similar issue with 3006.x but in my case restarting the master does not have any effect and only a minion restart resolves the issue.

    Another oddity is that I can see in the minion logs that the minion is still receiving commands from the master and is able to execute them just fine but the master seemingly never receives the response data. If I issue a salt '*' service.restart salt-minion from the master all of the minions receive the command and restart and pop back up just fine and then communication will work for probably another 12 hours or so.

    I don't recall having this issue on 3005.x but I have not downgraded that far yet.. so far both 3006.5 and 3006.4 minions have the problem for me. I'll try to run a tcpdump if I have time

  8. ReubenM commented on Jan 29, 2024

    @ReubenM

    I am encountering similar issues. Everything is 3006.5.

    I've spent two day's thinking I broke something in some recent changes I made, but I've found that the minions jobs are succeeding, but they timeout trying to communicate back to the master. I'm thinking this may be related to concurrency + load. I use this for testing environment automation, and during tests I have concurrent jobs fired off by the scheduler for test data collections. And that is where the issues start to show up in the logs. When this happens, the minions seem to try to re-send the data which just compounds the problem. The logs on the master show that it is getting the messages because it is flagging duplicate messages, but something seems to be getting lost processing the return data.

    The traces all look the same and seem to indicate something is getting dropped in concurrency related code:

    2024-01-29 15:22:57,215 [salt.master      :1924][ERROR   ][115353] Error in function minion_pub:
    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py", line 1910, in pub
        payload = channel.send(payload_kwargs, timeout=timeout)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/asynchronous.py", line 125, in wrap
        raise exc_info[1].with_traceback(exc_info[2])
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/asynchronous.py", line 131, in _target
        result = io_loop.run_sync(lambda: getattr(self.obj, key)(*args, **kwargs))
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/ioloop.py", line 459, in run_sync
        return future_cell[0].result()
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/concurrent.py", line 249, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1064, in run
        yielded = self.gen.throw(*exc_info)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/client.py", line 338, in send
        ret = yield self._uncrypted_transfer(load, timeout=timeout)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1056, in run
        value = future.result()
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/concurrent.py", line 249, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1064, in run
        yielded = self.gen.throw(*exc_info)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/client.py", line 309, in _uncrypted_transfer
        ret = yield self.transport.send(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1056, in run
        value = future.result()
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/concurrent.py", line 249, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1064, in run
        yielded = self.gen.throw(*exc_info)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 909, in send
        ret = yield self.message_client.send(load, timeout=timeout)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1056, in run
        value = future.result()
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/concurrent.py", line 249, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1064, in run
        yielded = self.gen.throw(*exc_info)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 589, in send
        recv = yield future
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/gen.py", line 1056, in run
        value = future.result()
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/tornado/concurrent.py", line 249, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
    salt.exceptions.SaltReqTimeoutError: Message timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py", line 387, in run_job
        pub_data = self.pub(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py", line 1913, in pub
        raise SaltReqTimeoutError(
    salt.exceptions.SaltReqTimeoutError: Salt request timed out. The master is not responding. You may need to run your command with `--async` in order to bypass the congested event bus.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 1918, in run_func
        ret = getattr(self, func)(load)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/master.py", line 1839, in minion_pub
        return self.masterapi.minion_pub(clear_load)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/daemons/masterapi.py", line 952, in minion_pub
        ret["jid"] = self.local.cmd_async(**pub_load)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py", line 494, in cmd_async
        pub_data = self.run_job(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/client/__init__.py", line 409, in run_job
        raise SaltClientError(general_exception)
  9. darkpixel commented on Feb 13, 2024

    @darkpixel
    Contributor

    I just discovered something.

    At any random time I might have 25-50 minions that don't appear to respond to jobs. They may or may not respond to test.ping, but definitely won't respond to something like state.sls somestate.

    ...buuuut they ARE actually are listening to the master.

    So my workflow is stupidly:

    salt '*' minion.restart
    # Wait for every minion to return that it failed to respond
    salt '*' state.sls somestate
    
  10. raddessi commented on Feb 13, 2024

    @raddessi
    Contributor

    @darkpixel Yes I have found the same thing and have the same workflow. Something just gets stuck and responses get lost somewhere. They are always receiving events however as you say, in my experience

  11. raddessi commented on Feb 23, 2024

    @raddessi
    Contributor

    This seems to still be an issue on 3006.7 when both minion and master are the same version

  12. darkpixel commented on Mar 11, 2024

    @darkpixel
    Contributor

    3007.0 is...worse?

    Woke up to all ~600 minions in an environment being offline.

    salt '*' test.ping failed for every minion.

    The log showed returns from every minion, but the master spit out Minion did not return: [Not connected] for every single one.

    Restarted the salt-master service, got distracted for ~15 minutes, ran another test.ping and several hundred failed to respond.

    Used Cluster SSH to connect in to every machine I can reach across the internet and restarted the salt-minion service and I'm down to a mix of ~60 (Windows, Linux, and BSD) that don't respond and I can't reach. Maybe 10 of them are 3006.7.

    I'd love to test/switch to a different transport like websockets that would probably be more stable, but it appears to be "all or nothing". If I switch to websockets on the master, it looks like every minion will disconnect unless I also update them to use websockets...and if I update them to use websockets and something breaks, I'm going to have to spend the next month trying to get access to hosts to fix salt-minion.

  13. 185 remaining items

  14. dwoz commented on Aug 1, 2025

    @dwoz
    Contributor

    @gou177 Is there any chance you can validate the changes in #68222 properly address this issue?

  15. darkpixel commented on Aug 27, 2025

    @darkpixel
    Contributor

    Here's something new I just noticed. When minions stop responding (at least on the Linux side of things), I can call service salt-minion stop and then run ps uaxwww | grep salt and there are a handful of processes still running...something related to returns I think. Unfortunately I just noticed while fixing a bunch of my b0rked minions but didn't grab the output.

    I should be able to grab it in a few days.

  16. darkpixel commented on Sep 5, 2025

    @darkpixel
    Contributor

    Caught it on my salt master.

    All the minions stopped getting certificates complaining "ca_server did not respond. Salt master must permit peers to call the sign_remote_certificate function."

    Stopped the salt-master, salt-minion, and salt-api services on the master and processes were left running:

    Image

    Restarting the master and master's minion were no help, but stopping them and doing a pkill -f salt-minion and then restarting them fixed the issue.

  17. Ikramromdhani commented on Sep 17, 2025

    @Ikramromdhani

    Any idea if this issue maybe included in 3006.16? and if yes do we have a timeline for it? I can see this issue happening with 3006.10 and it is occurring more frequently in big salt infra. I also think it sensitive to keep restarting thousands minions just to work around this issue.

  18. dwoz commented on Sep 18, 2025

    @dwoz
    Contributor

    @qianguih @darkpixel @gou177 @dnessett

    This along with #68297 should now be resolved in 3006.16. Please confirm.

  19. darkpixel commented on Sep 26, 2025

    @darkpixel
    Contributor

    Found the processes that were having a problem.
    On the salt master after stopping the salt-master, salt-minion, and salt-api, the following salt-minion processes are left running:

    root@salt:~# ps uaxwww | grep -i salt
    root      592561  0.0  0.2 724600 72988 ?        Sl   Sep21   0:01 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20250921150027402336) Minion._thread_return
    root     2809765  0.0  0.2 740944 85900 ?        S    Sep19   5:00 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager
    root     3641300  0.0  0.0   6340  2112 pts/13   S+   12:06   0:00 grep -i salt
    root@salt:~# ps uaxwww | grep -i salt
    

    Unless you manually kill those processes, and sort of remote communication will fail. i.e. having a minion (my-customer-minion) try to get the salt master's minion to sign a certificate and return it.

    Doing a 'service salt-minion stop' or service 'salt-minion restart' won't remove those gorked processes.

    The master's minion log is full of:

    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 395, in consume
        await callback(msg)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/client.py", line 497, in wrap_callback
        payload = self.transport._decode_messages(messages)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 324, in _decode_messages
        payload = salt.payload.loads(messages)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/payload.py", line 109, in loads
        raise SaltDeserializationError(exc_msg) from exc
    salt.exceptions.SaltDeserializationError: Could not deserialize msgpack message. See log for more info.
    2025-09-26 12:08:43,169 [salt.payload     ][payload][CRITICAL] Could not deserialize msgpack message. This often happens when trying to read a file not in binary mode. To see message payload, enable debug logging and retry. Exception: unpack(b) received extra data.
    2025-09-26 12:08:43,171 [salt.transport.zeromq][zeromq][ERROR   ] Exception while running callback
    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/payload.py", line 92, in loads
        ret = salt.utils.msgpack.unpackb(msg, **loads_kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/msgpack.py", line 137, in unpackb
        return msgpack.unpackb(packed, **_sanitize_msgpack_unpack_kwargs(kwargs))
      File "msgpack/_unpacker.pyx", line 201, in msgpack._cmsgpack.unpackb
    msgpack.exceptions.ExtraData: unpack(b) received extra data.
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 395, in consume
        await callback(msg)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/channel/client.py", line 497, in wrap_callback
        payload = self.transport._decode_messages(messages)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/transport/zeromq.py", line 324, in _decode_messages
        payload = salt.payload.loads(messages)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/payload.py", line 109, in loads
        raise SaltDeserializationError(exc_msg) from exc
    salt.exceptions.SaltDeserializationError: Could not deserialize msgpack message. See log for more info.
    

    I'm not entirely certain if those errors are related, but they seem to coincide with remote communication breaking.
    Once I kill those processes and restart the minion, everything works beautifully.

  20. dwoz commented on Sep 30, 2025

    @dwoz
    Contributor

    @darkpixel Can you confirm this is on 3006.16 and can you please open a new issue for this?

  21. dwoz commented on Oct 10, 2025

    @dwoz
    Contributor

    @darkpixel Can you confirm this is on 3006.16 and can you please open a new issue for this?

    @darkpixel ping.

  22. ldav1s commented on Oct 15, 2025

    @ldav1s
    Contributor

    I seem to have reproduced @darkpixel 's problem on 3006.16. I attempted a sudo systemctl restart salt-minion about an hour ago. That command returned without error. I then attempted a test.ping from the master which timed out. So I logged into the host:

    $ sudo systemctl status salt-minion.service 
    ● salt-minion.service - The Salt Minion
         Loaded: loaded (/lib/systemd/system/salt-minion.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Wed 2025-10-15 19:40:05 UTC; 41min ago
           Docs: man:salt-minion(1)
                 file:///usr/share/doc/salt/html/contents.html
                 https://docs.saltproject.io/en/latest/contents.html
        Process: 81226 ExecStart=/usr/bin/salt-minion (code=exited, status=1/FAILURE)
       Main PID: 81226 (code=exited, status=1/FAILURE)
          Tasks: 7 (limit: 309126)
         Memory: 450.8M
         CGroup: /system.slice/salt-minion.service
                 ├─  66658 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20251015190818334152) Minion._thread_return
                 └─1079760 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager
    

    According to ps aux process 1079760 was from the time I installed 3006.16 on this minion or later that same day:

    $ ps aux | grep salt
    root       66658  0.5  0.0 818072 147684 ?       Sl   19:08   0:25 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager ProcessPayload(jid=20251015190818334152) Minion._thread_return
    ldavis    109652  0.0  0.0  12252  2132 pts/0    S+   20:22   0:00 grep --color=auto salt
    root     1079760  0.2  0.0 754980 94736 ?        S    Sep26  66:57 /opt/saltstack/salt/bin/python3.10 /usr/bin/salt-minion MultiMinionProcessManager MinionProcessManager
    

    As part of the job I use to install the salt-minion onedir packages, I do attempt to restart the service post-install shortly after the install completes. I tended to get less unstarted minions that way in the past (and currently).

    After killing the old process:

    $ sudo kill -9 1079760
    

    and sudo systemctl restart salt-minion.service on the node I was able to test.ping from the minion's salt master again and receive a response.

    The salt master is running 3006.16 (onedir, Ubuntu 20.04, installed through apt, with additions for gitfs remote pillars and state repos) and manages minions also on 3006.16 (onedir, Ubuntu 20.04, installed through apt). The minions themselves are a mix of on-prem hosts (2 datacenters; salt connects through a public interface) the and VMs (same 2 datacenters as on-prem; salt connects through a private interface).

  23. ldav1s commented on Oct 15, 2025

    @ldav1s
    Contributor

    Also observing Minion._thread_return processes hanging around inappropriately post sudo systemctl stop salt-minion.

  24. ldav1s commented on Oct 15, 2025

    @ldav1s
    Contributor

    Noticed that /lib/systemd/system/salt-minion.service has:

    [Service]
    KillMode=process
    

    instead of the default control-group. I might be trying that with a drop-in.

  25. barneysowood commented on Oct 15, 2025

    @barneysowood
    Collaborator

    @ldav1s - please open a new issue and put all the details in that. Thanks!

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

Metadata

Metadata

Assignees

Labels

Transportbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions