From eb1c6392095947b3205c4d52cd9b1507e6cd776b Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Thu, 3 Feb 2022 14:04:07 -0800 Subject: [PATCH] Take the lock before unlinking the mmap'ed shared memory to ensure all writes are finished and visible. --- collect/shared_dict.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collect/shared_dict.py b/collect/shared_dict.py index ac390bc..ec76138 100644 --- a/collect/shared_dict.py +++ b/collect/shared_dict.py @@ -108,7 +108,8 @@ class SharedDict(object): def cleanup(self) -> None: if not hasattr(self, 'shared_memory'): return - self.shared_memory.unlink() + with SharedDict.MPLOCK: + self.shared_memory.unlink() def clear(self) -> None: self._save_memory({}) -- 2.45.2