openSUSE / salt

openSUSE and SUSE patches and backports for SaltStack
Apache License 2.0
22 stars 52 forks source link

Prevent possible exception in tornado.concurrent.Future._set_done #638

Closed vzhestkov closed 5 months ago

vzhestkov commented 6 months ago

What does this PR do?

In some cases the exception is possible if tornado.concurrent.Future._set_done called not just once.

This PR is a partial backport of https://github.com/tornadoweb/tornado/pull/2253 Only one of the commits from the PR above: https://github.com/tornadoweb/tornado/commit/6e8a137e6824716531d749bce8a18a1f229ed873

No need to push it to the upstream as it get rid of salt.ext.tornado.

What issues does this PR fix or reference?

Tracks: https://github.com/SUSE/spacewalk/issues/23526

Previous Behavior

Possible tracebacks like the following in very specific cases:

Future <salt.ext.tornado.concurrent.Future object at 0x7f9136b21278> exception was never retrieved: Traceback
  File "/usr/lib/python3.6/site-packages/salt/transport/ipc.py", line 342, in _connect
    self._connecting_future.set_result(True)
  File "/usr/lib/python3.6/site-packages/salt/ext/tornado/concurrent.py", line 290, in set_result
    self._set_done()
  File "/usr/lib/python3.6/site-packages/salt/ext/tornado/concurrent.py", line 333, in _set_done
    for cb in self._callbacks:
TypeError: 'NoneType' object is not iterable

New Behavior

No such exception.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.