Repository navigation
Description
We are trying to upgrade our salt packages from 2015.5.3 to 2015.8.3. One issue popped up during the evaluation. We have two lines of salt-call statements that we run on the salt master node (no salt-minion package installed on the master node). With version 2015.5.3 they ran fine. But with version 2015.8.3 the following exception was raised:
[ERROR ] Future exception was never retrieved: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/tornado/gen.py", line 230, in wrapper
yielded = next(result)
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 495, in eval_master
pub_channel = salt.transport.client.AsyncPubChannel.factory(self.opts, **factory_kwargs)
File "/usr/lib/python2.7/dist-packages/salt/transport/client.py", line 154, in factory
return salt.transport.zeromq.AsyncZeroMQPubChannel(opts, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/transport/zeromq.py", line 253, in __init__
self.auth = salt.crypt.AsyncAuth(self.opts, io_loop=self.io_loop)
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 323, in __new__
new_auth.__singleton_init__(opts, io_loop=io_loop)
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 361, in __singleton_init__
self.get_keys()
File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 575, in get_keys
salt.utils.verify.check_path_traversal(self.opts['pki_dir'], user)
File "/usr/lib/python2.7/dist-packages/salt/utils/verify.py", line 400, in check_path_traversal
raise SaltClientError(msg)
SaltClientError: Could not access /etc/salt/pki/minion. Path does not exist.
Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored
Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored
Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored
Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored
...
The ValueError: 'I/O operation on closed file' kept popping to stderr until the last bit of memory was exhausted and the salt master node stopped responding.
I was actually able to reproduce the issue with a very simple salt setup.
-
Clone salt-vagrant-demo.
-
Run
vagrant upto launch and setup the stack. -
vagrant ssh masterto login to the master node, switch to the root user. -
Edit
/etc/hostsand add the following line:192.168.50.10 salt -
Create a simple state file. Mine was like the following:
root@saltmaster:~# cat /srv/salt/tony/init.sls tony_script: cmd.run: - name: date - user: root - group: root - shell: /bin/bash -
Run the state on the salt node.
root@saltmaster:/srv/salt/tony# salt-call state.sls tony [ERROR ] Future exception was never retrieved: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/tornado/gen.py", line 230, in wrapper yielded = next(result) File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 495, in eval_master pub_channel = salt.transport.client.AsyncPubChannel.factory(self.opts, **factory_kwargs) File "/usr/lib/python2.7/dist-packages/salt/transport/client.py", line 154, in factory return salt.transport.zeromq.AsyncZeroMQPubChannel(opts, **kwargs) File "/usr/lib/python2.7/dist-packages/salt/transport/zeromq.py", line 253, in __init__ self.auth = salt.crypt.AsyncAuth(self.opts, io_loop=self.io_loop) File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 323, in __new__ new_auth.__singleton_init__(opts, io_loop=io_loop) File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 361, in __singleton_init__ self.get_keys() File "/usr/lib/python2.7/dist-packages/salt/crypt.py", line 575, in get_keys salt.utils.verify.check_path_traversal(self.opts['pki_dir'], user) File "/usr/lib/python2.7/dist-packages/salt/utils/verify.py", line 400, in check_path_traversal raise SaltClientError(msg) SaltClientError: Could not access /etc/salt/pki/minion. Path does not exist. Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored Exception ValueError: 'I/O operation on closed file' in <bound method SyncWrapper.__del__ of <salt.utils.async.SyncWrapper object at 0x7f026c0a4990>> ignored ...
BTW here is the version report:
root@saltmaster:~# salt --versions-report
Salt Version:
Salt: 2015.8.3
Dependency Versions:
Jinja2: 2.7.2
M2Crypto: Not Installed
Mako: 0.9.1
PyYAML: 3.10
PyZMQ: 14.0.1
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.4
cffi: Not Installed
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: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-71-generic
system: Ubuntu 14.04 trusty
Activity
jfindlay commentedon Dec 15, 2015
@tonyyang132, thanks for the report. Ping @cachedout, @dmurphy18.
dmurphy18 commentedon Dec 15, 2015
@tonyyang132 this is similar to #27063. Thanks for the information. It shall be rectified in the next release.
tonyyang132 commentedon Dec 16, 2015
@jfindlay @dmurphy18 Thanks for your update. I'm sure creating relevant directories in the (un)packaging phase would make the issue go away, but I don't know if it would address the issue completely. I understand that without these directories,
salt-callwould not work properly and certain exceptions would be raised. But what makes the issue horrible is the non-stop complaintValueError: 'I/O operation on closed file'and finally the exhaustion of system memory. I guess somewhere deep down certain resources are not handled properly.I modified the method
SyncWrapper.__del__in/usr/lib/python2.7/dist-packages/salt/utils/async.pya little bit and added a print statement.Then I ran
salt-callon the master node.It looks like the first attempt of closing io_loop succeeded. Subsequent such attempts all led to the
ValueError: 'I/O operation on closed file'exception. If this is the case, there shouldn't have been these subsequent attempts in the first place.The whole theory is just my rough guess and could very well be wrong. I'm just hoping this could provide you with more clues.
tonyyang132 commentedon Dec 16, 2015
One more question, is there any plan when the next release will roll out?
dmurphy18 commentedon Dec 17, 2015
@tonyyang132 The next release is currently going to be after Christmas (due to holiday period vacations), probably sometime in January.
tonyyang132 commentedon Dec 18, 2015
@dmurphy18 Thank you for sharing the plan. BTW do you or someone from your team have any comments on my concerns about certain resources not being handled properly? Or was I just being totally paranoid here and those theories were not valid?
dmurphy18 commentedon Dec 18, 2015
@tonyyang132 Nope not paranoid, the issues with pkl directories will be addressed in the next release and then make sure that there are no other issues
8 remaining items
alangarf commentedon Jan 21, 2016
Any progress on this, this is an embarrassing and annoying bug that doesn't seem to be getting any traction in getting fixed. Late January is surely post Christmas enough. A time frame would be really helpful as this bit bad when we upgraded existing machines without issue, but then a whole stack of autoscaled machines exploded when launched because the pki dir was missing on start up.
dmurphy18 commentedon Jan 21, 2016
@alangarf The changes are ready in packaging, but we are trying to get code tests running clean before we tag the next point release, which is very soon (issue on Arch and another on Ubuntu 15.10). Once the tests are clean, will tag, package and test immediately.
alangarf commentedon Jan 21, 2016
@dmurphy18 thanks for replying. Although should I be worried that this is appearing to be a fix in the "packaging"? Sure a
mkdirin the package build puts a bandaid on the symptom but doesn't address @tonyyang132 comment aboutwhat makes the issue horrible is the non-stop complaint ValueError: 'I/O operation on closed file' and finally the exhaustion of system memory. I guess somewhere deep down certain resources are not handled properly.In the next release is this a proper fix to the core of the issue or just a packaging change to include the creation of the missing dir?
dmurphy18 commentedon Jan 22, 2016
@alangarf packaging change to include the creation of the missing dir; this is needed (fixes the infinite loop) but not the total fix which requires additional work. The packaging changes are also in conjunction with other issues arising (sorry don't have the numbers to hand).
meggiebot commentedon Feb 24, 2016
@DmitryKuzmenko can you look at this when you get back?
DmitryKuzmenko commentedon Feb 29, 2016
Fixed the io operation error in #31544