lemonade: a failed backend install during serve leaves the spawned lemond running

Aperta Adatta ai principianti
#729 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend, devtools

Direzione di ricerca

Leggi il ramo del router dopo spawn_lemond in engines/lemonade/src/lib.rs e confronta la gestione degli errori con install_best_llamacpp_backend in backend_alignment.rs. Esamina il percorso di recupero esistente per la preparazione del serve menzionato nell’issue per trovare un modo di provocare un errore nell’installazione del backend. Il lavoro è completato quando un controllo di disponibilità o una selezione del backend non riusciti arrestano il processo figlio avviato e ne attendono la terminazione, e un test conferma che non resta alcun processo lemond.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What happens

In the Lemonade engine's serve path (engines/lemonade/src/lib.rs, the router branch after spawn_lemond), two early returns leave the spawned lemond running:

let mut child = crate::process::spawn_lemond(...)?;
...
crate::process::wait_for_lemonade_cli_status(...)
    .context("Lemonade server did not become ready")?;          // returns, child left running
let backend = crate::backend_alignment::ensure_best_llamacpp_backend(...)
    .context("failed to select a supported Lemonade llama.cpp backend")?; // same

The later failure paths in the same function (load_result failing, or the router not reporting the model) do call terminate_pid(child.id(), true) and child.wait() before returning. Its sibling install_best_llamacpp_backend in backend_alignment.rs does the same unconditionally around the same two calls.

Why it matters

When the llama.cpp backend install fails, which is exactly the case rocm serve already retries once and then tells the user to rocm engines install lemonade --reinstall, the engine exits with an error but its lemond keeps running. It still holds the port and its state.

Not verified

Whether anything on the rocm serve side later reaps that lemond, for example a stop through the service record that recorded its pid via write_running_state(..., Some(child.id()), "running"). This was found by reading the code. In the e2e suite the harness's teardown kills it, so no test shows the leak.

Suggested fix

Run both calls inside a closure and terminate the child on its Err, as install_best_llamacpp_backend does. Add a unit or e2e assertion that no lemond survives a failed backend install; @id:serve-lemonade-preparation-recovery already drives that failure with a planted runtime once #351 lands.

Raised in review on #351.

Lingua principale
Rust
Stelle
49
Fork
14
Merge medio
2g 20h
PR unite (30g)
171

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ROCm/rocm-cli

Tutte le issue di ROCm/rocm-cli

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.