@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / f88e84016f
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[BugFix] Fix async core engine client finalizer (#24540)

Signed-off-by: Nick Hill <nhill@redhat.com>

Nick Hill committed Sep 9, 2025 at 21:07 UTC f88e84016fdd3f1ab081c18357096576b1f8fb71
1 file changed +6 -4
vllm/v1/engine/core_client.py
+6 -4
@@ -347,8 +347,9 @@ class BackgroundResources:
347
348 if isinstance(self.output_socket, zmq.asyncio.Socket):
349 # Async case.
350 - loop = self.output_socket._get_loop()
351 - asyncio.get_running_loop()
350 + loop = self.output_queue_task._loop \
351 + if self.output_queue_task else None
352 +
353 sockets = (self.output_socket, self.input_socket,
354 self.first_req_send_socket, self.first_req_rcv_socket,
355 self.stats_update_socket)
@@ -359,11 +360,12 @@ class BackgroundResources:
360 close_sockets(sockets)
361 for task in tasks:
362 if task is not None and not task.done():
362 - task.cancel()
363 + with contextlib.suppress(Exception):
364 + task.cancel()
365
366 if in_loop(loop):
367 close_sockets_and_tasks()
366 - elif not loop.is_closed():
368 + elif loop and not loop.is_closed():
369 loop.call_soon_threadsafe(close_sockets_and_tasks)
370 else:
371 # Loop has been closed, try to clean up directly.