issue #490: prevent double close() destroying unrelated Connection.

issue510
David Wilson 6 years ago
parent bf676aacfe
commit 38a553d42d

@ -748,10 +748,14 @@ class Connection(ansible.plugins.connection.ConnectionBase):
self.router = None self.router = None
# #420: Ansible executes "meta" actions in the top-level process, # #420: Ansible executes "meta" actions in the top-level process,
# meaning "reset_connection" will cause :class:`mitogen.core.Latch` FDs # meaning "reset_connection" will cause :class:`mitogen.core.Latch`
# to be cached and erroneously shared by children on subsequent # FDs to be cached and erroneously shared by children on subsequent
# WorkerProcess forks. To handle that, call on_fork() to ensure any # WorkerProcess forks. To handle that, call on_fork() to ensure any
# shared state is discarded. # shared state is discarded.
# #490: only attempt to clean up when it's known that some
# resources exist to cleanup, otherwise later __del__ double-call
# to close() due to GC at random moment may obliterate an unrelated
# Connection's resources.
mitogen.fork.on_fork() mitogen.fork.on_fork()
def close(self): def close(self):

Loading…
Cancel
Save