Refine error reporting for subprocess crash
On windows, the exit status winds up being the search term many users search for and end up piling in on issues that are unrelated. This refines the reporting so that if we have a more detailed message we'll suppress the exit status portion of the message.
This commit is contained in:
parent
80ee9b5e47
commit
a3c20e3f18
1 changed files with 12 additions and 9 deletions
|
@ -417,7 +417,17 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
|
||||||
|
|
||||||
// reap subprocess when it exits
|
// reap subprocess when it exits
|
||||||
go func() {
|
go func() {
|
||||||
s.done <- s.cmd.Wait()
|
err := s.cmd.Wait()
|
||||||
|
// Favor a more detailed message over the process exit status
|
||||||
|
if err != nil && s.status != nil && s.status.LastErrMsg != "" {
|
||||||
|
slog.Debug("llama runner terminated", "error", err)
|
||||||
|
if strings.Contains(s.status.LastErrMsg, "unknown model") {
|
||||||
|
s.status.LastErrMsg = "this model is not supported by your version of Ollama. You may need to upgrade"
|
||||||
|
}
|
||||||
|
s.done <- fmt.Errorf(s.status.LastErrMsg)
|
||||||
|
} else {
|
||||||
|
s.done <- err
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return s, nil
|
return s, nil
|
||||||
|
@ -580,14 +590,7 @@ func (s *llmServer) WaitUntilRunning(ctx context.Context) error {
|
||||||
slog.Warn("client connection closed before server finished loading, aborting load")
|
slog.Warn("client connection closed before server finished loading, aborting load")
|
||||||
return fmt.Errorf("timed out waiting for llama runner to start: %w", ctx.Err())
|
return fmt.Errorf("timed out waiting for llama runner to start: %w", ctx.Err())
|
||||||
case err := <-s.done:
|
case err := <-s.done:
|
||||||
msg := ""
|
return fmt.Errorf("llama runner process has terminated: %w", err)
|
||||||
if s.status != nil && s.status.LastErrMsg != "" {
|
|
||||||
msg = s.status.LastErrMsg
|
|
||||||
}
|
|
||||||
if strings.Contains(msg, "unknown model") {
|
|
||||||
return fmt.Errorf("this model is not supported by your version of Ollama. You may need to upgrade")
|
|
||||||
}
|
|
||||||
return fmt.Errorf("llama runner process has terminated: %v %s", err, msg)
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if time.Now().After(stallTimer) {
|
if time.Now().After(stallTimer) {
|
||||||
|
|
Loading…
Reference in a new issue