mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Catch an import error in ZMQ transport that happens on teardown of python
This commit is contained in:
parent
d352af4573
commit
488619d814
1 changed files with 9 additions and 2 deletions
|
@ -524,6 +524,7 @@ class AsyncReqMessageClient:
|
|||
# The python interpreter has nuked most attributes already
|
||||
return
|
||||
else:
|
||||
teardown = False
|
||||
self._closing = True
|
||||
if hasattr(self, "stream") and self.stream is not None:
|
||||
if ZMQ_VERSION_INFO < (14, 3, 0):
|
||||
|
@ -535,10 +536,16 @@ class AsyncReqMessageClient:
|
|||
self.stream.socket = None
|
||||
self.socket.close()
|
||||
else:
|
||||
self.stream.close(1)
|
||||
try:
|
||||
self.stream.close(1)
|
||||
except ImportError:
|
||||
# On teardown of python, this can sometimes throw and ImportError
|
||||
# because sys.meta_path turns to None
|
||||
teardown = True
|
||||
self.socket = None
|
||||
self.stream = None
|
||||
if self.context.closed is False:
|
||||
if self.context.closed is False and not teardown:
|
||||
# This hangs if closing the stream causes an import error
|
||||
self.context.term()
|
||||
|
||||
def _init_socket(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue