Skip to content

Commit

Permalink
[BugFix] Avoid secondary error in ShmRingBuffer destructor (#6530)
Browse files Browse the repository at this point in the history
  • Loading branch information
njhill authored Jul 18, 2024
1 parent 1c27d25 commit d25877d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vllm/distributed/device_communicators/shm_broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ def __reduce__(self):
)

def __del__(self):
self.shared_memory.close()
if self.is_creator:
self.shared_memory.unlink()
if hasattr(self, "shared_memory"):
self.shared_memory.close()
if self.is_creator:
self.shared_memory.unlink()

@contextmanager
def get_data(self, current_idx: int):
Expand Down Expand Up @@ -428,7 +429,6 @@ def enqueue(self, obj):

def dequeue(self):
if self._is_local_reader:
overflow = False
with self.acquire_read() as buf:
overflow = buf[0] == 1
if not overflow:
Expand Down

0 comments on commit d25877d

Please sign in to comment.