diff --git a/python/mlc_llm/serve/engine_base.py b/python/mlc_llm/serve/engine_base.py index 0c7b908374..d038dd0282 100644 --- a/python/mlc_llm/serve/engine_base.py +++ b/python/mlc_llm/serve/engine_base.py @@ -659,6 +659,8 @@ def terminate(self): if hasattr(self, "_terminated") and self._terminated: return self._terminated = True + if not hasattr(self, "_ffi"): + return self._ffi["exit_background_loop"]() if hasattr(self, "_background_loop_thread"): self._background_loop_thread.join()