salt icon indicating copy to clipboard operation
salt copied to clipboard

Salt command can hang forever because of one broken minion

Open bobrik opened this issue 10 years ago • 7 comments

Description of Issue/Question

I have a fleet of ~300 minions and some of them are broken. Two are down and one is somehow screwed to the point where saltutil module is not found.

The following command never returns on my master:

salt '*' test.ping

It does the internal loop, but never times out or prints any new results after the initial batch of healthy minion returns.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

I did some good old log.debug style debugging to figure out the reason for this. The relevant function:

  • https://github.com/saltstack/salt/blob/8f71413/salt/client/init.py#L986

I added log.debug("raw={}".format(raw)). In the output I saw the following line over and over:

[DEBUG   ] raw={'tag': 'salt/job/20160621091134724456/ret/minion-with-the-broken-saltuitl', 'data': {'fun_args': ['20160621090958662043'], 'jid': '20160621091134724456', 'return': "Module 'saltutil' is not available.", 'retcode': 254, 'success': False, 'cmd': '_return', '_stamp': '2016-06-21T09:11:35.120462', 'fun': 'saltutil.find_job', 'id': 'minion-with-the-broken-saltuitl', 'out': 'nested'}}

I stopped the minion and salt command returned during the next iteration (timeout_at time happened), telling me that some (broken or down) salt minions timed out. I started the minion back and it works now, since saltutil module is found now.

There's no reason for one broken minion to keep the loop from breaking and it is quite frustrating when you never know which minions did the job and which timed out.

Versions Report

Salt master:

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: 0.3.6
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.4
        machine: x86_64
        release: 4.4.10-cloudflare
         system: Linux
        version: debian 8.

Salt minion (after restart when it works):

Salt Version:
           Salt: 2016.3.0rc3

Dependency Versions:
           cffi: 1.6.0
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.6.4
      gitpython: 1.0.2
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: 1.2.5
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.3
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.2
        machine: x86_64
        release: 4.1.3-cloudflare
         system: Linux
        version: debian 8.2

bobrik avatar Jun 21 '16 09:06 bobrik

@bobrik Thanks for the great investigatory work!

Did you recently upgrade that minion from 2015.8 branch that has the saltutil issues?

I think that particular issue might be related to this issue: #33531 where the saltutil path was not updated unless you restarted your minion after upgrading to 2016.3 from the 2015.8 branch.

Ch3LL avatar Jun 21 '16 17:06 Ch3LL

The issue is not about saltutil gone missing. Frankly, I don't know much about that minion that was malfunctioning. People were doing some kind of experimentation and left things in a broken state.

My problem is that salt command doesn't play well when this happens. It should return quickly as usually, but it does not return at all.

bobrik avatar Jun 21 '16 18:06 bobrik

@bobrik apologies I was not clear enough. I was just trying to clarify what was happening with that minion to attempt to try to replicate this, but it seems you are not sure what was occurring with the minion so this seems to not easily be replicated. Thanks for clarifying. :) Agreed the issue is that the command is not handling this data well enough.

Ch3LL avatar Jun 22 '16 17:06 Ch3LL

Is more information needed on this problem or is it being worked on?

I'm having the same issue since upgrading from 2015.5.8 (that version did not have this problem).

If I target any minion that is offline the salt command (on salt-master) hangs indefinitely. I've tried various versions of salt-master on CentOS7 (each time removing the old version and installed using yum via repo.saltstack.com). I don't recall the order I did the removal/install but I did test 2016.3.0, 2016.3.1, 2015.8.10, and 2015.5.10 and they all experience the same problem where running any salt command (test.ping, grains.get, state.sls, state.highstate) all hang if a single minion in the target list is offline at the time. Additionally when all the minions are online the commands work as they should.

The Minions in my env are a mix of CentOS7, Ubuntu 12, Ubuntu14, and Windows 8. It doesn't seem to matter which minion is offline. If any 1 minion is unreachable (and included as a target) salt hangs.

fayetted avatar Jul 15 '16 18:07 fayetted

Forgot to add that removing salt-master and salt-minion and re-installing 2015.5.8 the problem is gone. The salt command returns with "Minion did not return. [Not connected]" after 12 seconds (when I target 5 hosts, 4 online, 1 offline)

fayetted avatar Jul 15 '16 18:07 fayetted

Same issue here after upgrading. I have a small percentage of Salt minions that are temporarly down and I am having the same issue. This problem is also preventing me to run some commands like:

salt-run manage.status

The tricky part is that running:

salt '*' test.ping

stalls indefinitely instead if I get a full list of all my minions (connected and disconnected) and execute:

salt minion test.ping

one after the other, it properly timeouts when needed. At least in my case it seems that is the multiple target feature that creates the bug, not the behaviour of a single minion.

iplux avatar Aug 04 '16 13:08 iplux

All fixed. Take a look at #35446. Thanks!

cachedout avatar Aug 15 '16 12:08 cachedout