Unverified Commit 07eb6f19 authored by youkaichao's avatar youkaichao Committed by GitHub
Browse files

[bugfix][distributed] fix multi-node bug for shared memory (#6597)

parent f0bbfaf9
...@@ -108,8 +108,14 @@ class ShmRingBuffer: ...@@ -108,8 +108,14 @@ class ShmRingBuffer:
# created by the process. The following patch is a workaround. # created by the process. The following patch is a workaround.
with patch("multiprocessing.resource_tracker.register", with patch("multiprocessing.resource_tracker.register",
lambda *args, **kwargs: None): lambda *args, **kwargs: None):
self.shared_memory = shared_memory.SharedMemory(name=name) try:
assert self.shared_memory.size == self.total_bytes_of_buffer self.shared_memory = shared_memory.SharedMemory(name=name)
assert self.shared_memory.size == self.total_bytes_of_buffer # noqa
except FileNotFoundError:
# we might deserialize the object in a different node
# in this case, this object is not used,
# and we should suppress the error
pass
def __reduce__(self): def __reduce__(self):
return ( return (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment