szaszm commented on a change in pull request #1053:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1053#discussion_r624984755
##########
File path: docker/test/integration/MiNiFi_integration_test_driver.py
##########
@@ -32,34 +36,42 @@ def __init__(self, context):
self.file_system_observer = None
self.docker_network = None
+ self.cleanup_lock = threading.Lock()
self.docker_directory_bindings = DockerTestDirectoryBindings()
self.docker_directory_bindings.create_new_data_directories(self.test_id)
def __del__(self):
- logging.info("MiNiFi_integration_test cleanup")
-
- # Clean up network, for some reason only this order of events work for
cleanup
- if self.docker_network is not None:
- logging.info('Cleaning up network network: %s',
self.docker_network.name)
- while len(self.docker_network.containers) != 0:
- for container in self.docker_network.containers:
- self.docker_network.disconnect(container, force=True)
- self.docker_network.reload()
- self.docker_network.remove()
-
- container_ids = []
- for cluster in self.clusters.values():
- for container in cluster.containers.values():
- container_ids.append(container.id)
- del cluster
-
- # The cluster deleter is not reliable for cleaning up
- docker_client = docker.from_env()
- for container_id in container_ids:
- self.delete_docker_container_by_id(container_id)
-
- del self.docker_directory_bindings
+ self.cleanup()
+
+ def cleanup(self):
Review comment:
I'm not good at python, but is it possible that during a cleanup
invocation, clusters are deleted, but invalid references are left in
self.clusters, which are then dereferenced on a second cleanup invocation
during garbage collection? In other words, is this safe to be called more than
once?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]