@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 6b625a8807
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 7, 02:45 UTC

[Bugfix] Quickfix followups to busy loop removal in #28053 (#36068)

Signed-off-by: Travis Johnson <tsjohnso@us.ibm.com> Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>

Travis Johnson committed Mar 6, 2026 at 09:13 UTC 6b625a8807f4c82137c46d58dfb38f8eeef4865c
1 file changed +23 -22
vllm/v1/executor/multiproc_executor.py
+23 -22
@@ -157,10 +157,13 @@ class MultiprocExecutor(Executor):
157 global_start_rank = (
158 self.local_world_size * self.parallel_config.node_rank_within_dp
159 )
160 - # Keep track of socket file descriptors that are inherited by the
161 - # worker when using fork, so that we can close them in subsequent
160 + # When using fork, keep track of socket file descriptors that are
161 + # inherited by the worker, so that we can close them in subsequent
162 # workers
163 - inherited_fds: list[int] = []
163 + inherited_fds: list[int] | None = (
164 + [] if context.get_start_method() == "fork" else None
165 + )
166 +
167 for local_rank in range(self.local_world_size):
168 global_rank = global_start_rank + local_rank
169 is_driver_worker = self._is_driver_worker(global_rank)
@@ -175,13 +178,9 @@ class MultiprocExecutor(Executor):
178 inherited_fds=inherited_fds,
179 )
180 unready_workers.append(unready_worker_handle)
178 - if context.get_start_method() == "fork":
179 - inherited_fds.extend(
180 - [
181 - unready_worker_handle.death_writer.fileno(),
182 - unready_worker_handle.ready_pipe.fileno(),
183 - ]
184 - )
181 + if inherited_fds is not None:
182 + inherited_fds.append(unready_worker_handle.death_writer.fileno())
183 + inherited_fds.append(unready_worker_handle.ready_pipe.fileno())
184
185 # Workers must be created before wait_for_ready to avoid
186 # deadlock, since worker.init_device() does a device sync.
@@ -453,12 +452,13 @@ class MultiprocExecutor(Executor):
452 w.worker_response_mq.shutdown()
453 w.worker_response_mq = None
454
456 - if self.rpc_broadcast_mq is not None:
457 - self.rpc_broadcast_mq.shutdown()
455 + if rpc_broadcast_mq := getattr(self, "rpc_broadcast_mq", None):
456 + rpc_broadcast_mq.shutdown()
457 self.rpc_broadcast_mq = None
459 - for mq in self.response_mqs:
460 - mq.shutdown()
461 - self.response_mqs = []
458 + if response_mqs := getattr(self, "response_mqs", None):
459 + for mq in response_mqs:
460 + mq.shutdown()
461 + self.response_mqs = []
462
463 def check_health(self) -> None:
464 self.collective_rpc("check_health", timeout=10)
@@ -634,13 +634,16 @@ class WorkerProc:
634 input_shm_handle, # Receive SchedulerOutput
635 shared_worker_lock: LockType,
636 is_driver_worker: bool,
637 - inherited_fds: list[int],
637 + inherited_fds: list[int] | None = None,
638 ) -> UnreadyWorkerProcHandle:
639 context = get_mp_context()
640 # Ready pipe to communicate readiness from child to parent
641 ready_reader, ready_writer = context.Pipe(duplex=False)
642 # Death pipe to let child detect parent process exit
643 death_reader, death_writer = context.Pipe(duplex=False)
644 + if inherited_fds is not None:
645 + inherited_fds = inherited_fds.copy()
646 + inherited_fds.extend((ready_reader.fileno(), death_writer.fileno()))
647 process_kwargs = {
648 "vllm_config": vllm_config,
649 "local_rank": local_rank,
@@ -652,8 +655,7 @@ class WorkerProc:
655 "shared_worker_lock": shared_worker_lock,
656 "is_driver_worker": is_driver_worker,
657 # Have the worker close parent end of this worker's pipes too
655 - "inherited_fds": inherited_fds
656 - + [ready_reader.fileno(), death_writer.fileno()],
658 + "inherited_fds": inherited_fds if inherited_fds is not None else [],
659 }
660 # Run EngineCore busy loop in background process.
661 proc = context.Process(
@@ -697,9 +699,8 @@ class WorkerProc:
699 unready_proc_handles: list[UnreadyWorkerProcHandle],
700 ) -> list[WorkerProcHandle]:
701 e = Exception(
700 - "WorkerProc initialization failed due to "
701 - "an exception in a background process. "
702 - "See stack trace for root cause."
702 + "WorkerProc initialization failed due to an exception in a "
703 + "background process. See stack trace for root cause."
704 )
705
706 pipes = {handle.ready_pipe: handle for handle in unready_proc_handles}
@@ -802,7 +803,7 @@ class WorkerProc:
803 try:
804 os.close(fd)
805 except Exception as e:
805 - logger.warning("Exception closing inherited connection: %s", e)
806 + logger.warning("Error closing inherited connection: %s: %s", type(e), e)
807
808 try:
809 # Initialize tracer