From 78aa341d124e4e2162defdabde8e8b0a97ffb79d Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 14 May 2025 19:27:48 -0400 Subject: [PATCH] [CI] Fix race condition in test_kv_cache_events test (#18169) Signed-off-by: Russell Bryant --- tests/v1/engine/test_engine_core_client.py | 1 - vllm/distributed/kv_events.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/v1/engine/test_engine_core_client.py b/tests/v1/engine/test_engine_core_client.py index 671d74b83b85..71ebd0a36e46 100644 --- a/tests/v1/engine/test_engine_core_client.py +++ b/tests/v1/engine/test_engine_core_client.py @@ -292,7 +292,6 @@ def test_kv_cache_events( log_stats=False, ) endpoint = publisher_config.endpoint.replace("*", "127.0.0.1") - time.sleep(0.1) subscriber = MockSubscriber(endpoint, topic=publisher_config.topic, decode_type=KVEventBatch) diff --git a/vllm/distributed/kv_events.py b/vllm/distributed/kv_events.py index 1141a8e53c3b..29c6a70c4d26 100644 --- a/vllm/distributed/kv_events.py +++ b/vllm/distributed/kv_events.py @@ -130,6 +130,7 @@ class ZmqEventPublisher(EventPublisher): self._endpoint = endpoint self._replay_endpoint = replay_endpoint self._hwm = hwm + self._socket_setup() # Payload self._seq_gen = count() @@ -207,7 +208,6 @@ class ZmqEventPublisher(EventPublisher): def _publisher_thread(self) -> None: """Background thread that processes the event queue.""" self._pack = msgspec.msgpack.Encoder() - self._socket_setup() assert self._pub is not None # narrows type for mypy