[Bugfix] Close MessageQueue zmq resources via finalizer to avoid exit (#60472)

Signed-off-by: aarushjain29 <aarushi.jain2@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Aarushi Jain
2026-10-08 13:53:00 -05:00
committed by GitHub
co-authored by Andreas Karatzas
parent 56e6da2c47
commit 9bbc581560
2 changed files with 47 additions and 0 deletions
+22
View File
@@ -1,11 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import gc
import io
import pickle
import random
import threading
import time
import weakref
from types import SimpleNamespace
from unittest import mock
@@ -634,6 +636,26 @@ def test_acquire_read_releases_slot_when_reader_raises():
reader.shutdown()
def test_reader_in_reference_cycle_is_collected_without_blocking():
writer = MessageQueue(
n_reader=1,
n_local_reader=1,
max_chunk_bytes=1024 * 1024,
max_chunks=1,
)
reader = MessageQueue.create_from_handle(writer.export_handle(), rank=0)
reader.cycle = reader
reader_ref = weakref.ref(reader)
del reader
collector = threading.Thread(target=gc.collect, daemon=True)
collector.start()
collector.join(timeout=10)
assert not collector.is_alive()
assert reader_ref() is None
def test_warning_logs(caplog_vllm):
"""Test that warning logs are emitted at VLLM_RINGBUFFER_WARNING_INTERVAL intervals
when indefinite=False, and are not emitted when indefinite=True.