From: Xuan-Son Nguyen Date: Tue, 21 Apr 2026 22:26:09 +0000 (+0200) Subject: server: allow cancel loading model (#21814) X-Git-Tag: upstream/0.0.10438~1559 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=04fe84b69dd20084ea5b4ed4da578fb05c95eb10;p=pkg%2Fggml%2Fsources%2Fllama.cpp server: allow cancel loading model (#21814) --- diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp index 6066611f5..15c11c3c9 100644 --- a/tools/server/server-models.cpp +++ b/tools/server/server-models.cpp @@ -712,6 +712,11 @@ void server_models::unload(const std::string & name) { if (it->second.meta.is_running()) { SRV_INF("stopping model instance name=%s\n", name.c_str()); stopping_models.insert(name); + if (it->second.meta.status == SERVER_MODEL_STATUS_LOADING) { + // special case: if model is in loading state, unloading means force-killing it + SRV_WRN("model name=%s is still loading, force-killing\n", name.c_str()); + subprocess_terminate(it->second.subproc.get()); + } cv_stop.notify_all(); // status change will be handled by the managing thread } else {