[BugFix] Ensure appropriate guards in destructors (#25284)

Signed-off-by: Nick Hill <nhill@redhat.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Nick Hill 2025-09-19 18:06:34 -07:00 committed by GitHub
parent 8945b001db
commit a25ade5d47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 9 deletions

View File

@ -1183,7 +1183,7 @@ class AllReduceFusionPass(VllmInductorPass):
self.end_and_log()
def __del__(self):
if self.disabled:
if getattr(self, "disabled", True):
return
if flashinfer_comm is not None:
flashinfer_comm.trtllm_destroy_ipc_workspace_for_all_reduce(

View File

@ -569,9 +569,10 @@ class NixlConnectorWorker:
def __del__(self):
"""Cleanup background threads on destruction."""
self._handshake_initiation_executor.shutdown(wait=False)
if self._nixl_handshake_listener_t:
self._nixl_handshake_listener_t.join(timeout=0)
if executor := getattr(self, "_handshake_initiation_executor", None):
executor.shutdown(wait=False)
if listener_t := getattr(self, "_nixl_handshake_listener_t", None):
listener_t.join(timeout=0)
@staticmethod
def _nixl_handshake_listener(metadata: NixlAgentMetadata,

View File

@ -235,9 +235,6 @@ class ExecutorBase(ABC):
"""Shutdown the executor."""
self.collective_rpc("shutdown")
def __del__(self):
self.shutdown()
async def execute_model_async(
self,
execute_model_req: ExecuteModelRequest) -> List[SamplerOutput]:

View File

@ -683,7 +683,8 @@ class Worker(WorkerBase):
tensorizer_config=tensorizer_config, )
def shutdown(self) -> None:
self.model_runner.ensure_kv_transfer_shutdown()
if runner := getattr(self, "model_runner", None):
runner.ensure_kv_transfer_shutdown()
def init_worker_distributed_environment(