diff --git a/llm/server.go b/llm/server.go index c82c5099..c9636a82 100644 --- a/llm/server.go +++ b/llm/server.go @@ -902,7 +902,12 @@ func (s *llmServer) Close() error { if err := s.cmd.Process.Kill(); err != nil { return err } - return s.cmd.Wait() + + if err := s.cmd.Wait(); err != nil { + return err + } + + slog.Debug("llama server stopped") } return nil diff --git a/server/sched.go b/server/sched.go index 482bc39a..61c5e1b3 100644 --- a/server/sched.go +++ b/server/sched.go @@ -250,6 +250,7 @@ func (s *Scheduler) processCompleted(ctx context.Context) { defer runner.refMu.Unlock() if runner.expireTimer != nil { runner.expireTimer.Stop() + runner.expireTimer = nil } s.expiredCh <- runner }) @@ -430,6 +431,10 @@ type runnerRef struct { // The refMu must already be held when calling unload func (runner *runnerRef) unload() { + if runner.expireTimer != nil { + runner.expireTimer.Stop() + runner.expireTimer = nil + } if runner.llama != nil { runner.llama.Close() }