salt minion's returner local_cache error of extra return detected from minion 2015.8.3 on the master log
salt master is version of 2015.8.3 , minion is 2015.8.3
I check the salt master log file , get massive log_level ERROR messages from master log , like
2016-01-05 14:25:16,694 [salt.loaded.int.returner.local_cache ][ERROR ][26173] An extra return was detected from minion minion-1, please verify the minion, this could be a replay attack
2016-01-05 14:25:16,704 [salt.loaded.int.returner.local_cache ][ERROR ][26170] An extra return was detected from minion minion-2, please verify the minion, this could be a replay attack
2016-01-05 14:25:16,704 [salt.loaded.int.returner.local_cache ][ERROR ][26135] An extra return was detected from minion minion-3, please verify the:
those minions are Linux OS, all minion has only one salt master . and the minion log file did not have error messages
I check the error message in the source code file salt/returnser/local_cache.py method returner() line 150 and the tips is
Minion has already returned this jid and it should be dropped
it means the minion return jid more than one time
@WangWenchao, thanks for the report. What version of salt are you running on the master and minion(s)? Did this situation begin recently on a setup that has been working before? Can you describe your use case some more? Are you doing remote execution or state runs or something else? Do these errors happen without doing anything?
I just started getting this error as well, somewhat randomly from different minions.
I was updating pillar data for all my minions when it happened.
I too am running 2015.8.3 on both minions and master.
Doesn't seem to happen for other commands (tried cmd.run 'cat /dev/null' and test.ping)
@alandrees, you may have multiple minion daemon processes running somehow on those minions. Is this something you can verify?
Hi after updating from 2014.7.5 to the current 2015.8.7 we get the same error:
2016-02-22 15:00:51,797 [salt.loaded.int.returner.local_cache][ERROR][23565] An extra return was detected from minion salt.my.domain, please verify the minion, this could be a replay attack
There is only one minion running:
root@salt:/etc/salt :( # ps -ef | grep min[i]on
root 22829 1 0 14:21 ? 00:00:05 /usr/bin/python2.6 /usr/bin/salt-minion -d
Any ideas? Do you need more infos?
Cheers
@bemeyert, are you running the minion masterless?
@jfindlay Nope. Full blown master-minion setup. Also, when I run a salt-run manage.status I get tons of those errors. We are currently in the upgrade process. So the master runs 2015.8.7, some minions run 2015.8.7 and some 2014.7.5. But the error appears from all minions.
@bemeyert, do you see anything suspicious in salt-key -L or /etc/salt/pki/master or /var/cache/salt/master/minions?
I've had this same issue for a while. I have about 8000 minions, and at any point ~2000 spew the extra return when sending a command to them all. It started with 2015.8.0 IIRC. Nothing looks out of the norm with my keys, all minions are uniquely named. When I moved them over to a fresh master running 2015.8.5 with no keys, the same issue immediately cropped up.
Salt Version:
Salt: 2015.8.3
Dependency Versions:
Jinja2: 2.7.2
M2Crypto: 0.21.1
Mako: 0.9.1
PyYAML: 3.10
PyZMQ: 14.4.0
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.4
cffi: 0.8.2
cherrypy: Not Installed
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: 0.22.0
python-gnupg: 0.3.6
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.19.0-25-generic
system: Ubuntu 14.04 trusty
@jfindlay Salt seems to miraculously healed itself. This morning all errors were gone, although there were still machines with the old 2014.7. So, I rest my case ;)
BTW: Beryllium is blazing fast compared to 2014.7. Awesome job!
@bemeyert, nice!
@JaseFace, will you give more detail about how you updated your salt master/minions? This is normally a minion-side problem where the old minion's presence is not entirely removed from the system. It may also be helpful if there is anything you can think of on the master that suggests leftovers not getting scrubbed from a previous setup during upgrade or reconfiguration.
@jfindlay We've been having the problem of minions failing to stop during upgrades/restarts for quite a while, so our process to get around the small % of wedged minions is basically:
A state will upgrade the pkg or conf if required
If so, the watch in the custom cmd to restart is triggered:
service stop &
sleep; pkill -f salt-minion; sleep; pkill -9 -f salt-minion; sleep; service start
This happens outside of minion restarts or upgrades though. I might go run the process to kill all procs on all the boxes giving extra return, and we are good to go for a few hours. Slowly, with no changes to the service they start to quickly creep back up again. When looking at the boxes they are only running a single minion, so all I could imagine is job duplication happening somehow.
Procs spawned to do work during highstate or other scheduled events should never be on the bus or responding correct? I'm trying to theorize how jobs might be getting duplicated without multiple base minions actually running.
You said minion presence though.. are there other remnants besides a proc that could be confusing the running minion? The masters actually get restarted a few times a week on a cron because of memory leaks (I believe these are related to ZMQ and we have other tickets tracking those issues). If there is any cleanup/scrubbing that needs to be done between the rare upgrades or regular restarts (nuking cache?), let me know, and we can certainly try that.
@JaseFace, I'm not really sure what may be happening here, but there may be a bug or two lurking somewhere. Normally a master seeing duplicate responses from the same minion simply means there are multiple minion procs running on the minion's system.
I am curious about whether other users have similar issues or not and if not, if there is something specific to your setup that is exposing/causing this condition. @cachedout will likely have more and better questions/answers than I on these topics.
Reproducer
Same thing is happening on our SLE 12 at the very moment. At least we can reproduce the error the following way:
- Stop master, then run it in log mode:
salt-master -l error
- Stop minion, then start a service:
systemctl start salt-minion
- Contact minion:
salt 'your-great-minion' test.ping
- Restart minion:
systemctl restart salt-minion
Hint: on SUSE systems you can also just rc<service> <operation>, e.g.: rcsalt-minion restart
- Here, you have it. You get the following on the master:
[ERROR ] An extra return was detected from minion XXXXXXX, please verify the minion, this could be a replay attack
(the host name was replaced by XX...)
The reproducer is reliable. Version of Salt is 2015.8.4. Also, this log periodically appears just by itself without doing nothing.
Why this is happening?
If there is more than one process (e.g. two processes of a minion with "keepalive" is on), then apparently cache returner is simply trying to create a directory with the job ID to drop JID. And if the directory already exists, i.e. JID was already returned because the other instance already did it so, then this error happens, because this JID was already returned and supposed to be dropped, yet still in the returner's load.
To fix this, I'd propose an idea that each minion instance on the same machine should share certain data and make sure stay in sync. We can use PyRo or shared memory (pyro seems more reliable and Python 3 enabled): https://pypi.python.org/pypi/Pyro4
The main idea is that every minion just joins the club of running minions on the same machine and shares the data in between. So if one of the minions already dropped JID, it should beforehand report to the rest of the minions and modify returner's data. This way the next instance of the minion won't try to drop the same JID.
Same effect will happen with the Couch Base returner, by the way.
@jfindlay @cachedout @thatch45 opinions on this?
@isbm, thanks for the detailed reproducible case. We'll need to look into this.
I am experiencing the similar issue. Logs are being filled up with these replay attack error messages after upgrading the salt master:
Salt: 2015.8.7
Dependency Versions:
Jinja2: 2.2.1
M2Crypto: 0.20.2
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.5.0
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: centos 6.7 Final
machine: x86_64
release: 2.6.32-573.18.1.el6.x86_64
system: CentOS 6.7 Final
Minion Version:
Salt: 2015.5.8
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.4.6
msgpack-pure: Not Installed
pycrypto: 2.0.1
libnacl: Not Installed
PyYAML: 3.10
ioflo: Not Installed
PyZMQ: 14.3.1
RAET: Not Installed
ZMQ: 3.2.5
Mako: 0.3.4
Tornado: Not Installed
timelib: Not Installed
dateutil: Not Installed
Error Logs:
salt.loaded.int.returner.local_cache ][ERROR ][xxxx] An extra return was detected from minion xxxxxx, please verify the minion, this could be a replay attack
PS: We have full blown master-minion setup.
@jfindlay we have been trying to figure out the issue as it is filling out our logs and its kinda annoying at this moment due to this false replay attacks. Did you see similar issue being reported by other salt users ?
@sbatchu0108 I've explained the cause above in details. Yes, your version contains this bug.
@isbm I'm not sure to understand the part with "If there is more than one process (e.g. two processes of a minion with "keepalive" is on)": in your reproducible example, why would there be more than one processes of a minion running, as your are restarting it? (And then I suppose, the old one should exit and the new one should be spawned, and then you should only have one minion running, no?)
@multani how many processes you do have when minion is running, with systemd especially?
@isbm "several", I guess: (from a running instance)
$ pstree -ap | grep salt-minion
├─salt-minion,21497 /usr/bin/salt-minion
│ └─salt-minion,21502 /usr/bin/salt-minion
│ ├─{salt-minion},21503
│ ├─{salt-minion},21535
│ ├─{salt-minion},21536
│ ├─{salt-minion},21537
│ └─{salt-minion},21538
(However, as far as I remember, it has always been like this, hence I'm not really surprised.)
Also, I can't reproduce the problem using your procedure above. Although I have the same problem, I'm still not sure how to trigger it specifically, but it seems it happens when there are "too many minions refreshing pillars at the same time", in my case (I'm still trying to figure what "too many minions" is).