Take the lock before unlinking the mmap'ed shared memory to ensure
authorScott Gasch <[email protected]>
Thu, 3 Feb 2022 22:04:07 +0000 (14:04 -0800)
committerScott Gasch <[email protected]>
Thu, 3 Feb 2022 22:04:07 +0000 (14:04 -0800)
all writes are finished and visible.

collect/shared_dict.py

index ac390bc600e769a94c2205440883257a665917bb..ec76138b393955d47f3850bf2a91d425ada563b1 100644 (file)
@@ -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({})