From 6edb3f165d72f1c5ee40b23d642c6ab9404e4ebd Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 28 Apr 2018 22:08:35 +0100 Subject: [PATCH] ansible: avoid a race during shutdown. --- ansible_mitogen/process.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py index 8febea90..f5dc7be5 100644 --- a/ansible_mitogen/process.py +++ b/ansible_mitogen/process.py @@ -27,6 +27,7 @@ # POSSIBILITY OF SUCH DAMAGE. from __future__ import absolute_import +import errno import logging import os import socket @@ -167,4 +168,9 @@ class MuxProcess(object): happen explicitly, but Ansible provides no hook to allow it. """ self.pool.stop() - os.unlink(self.listener.path) + try: + os.unlink(self.listener.path) + except OSError, e: + # Prevent a shutdown race with the parent process. + if e.args[0] != errno.ENOENT: + raise