[Engine] 0.1.73 (v0.2.25): --serve without --expert-profile segfaults in the adaptive tier on the first request (host_res is empty)

Aperta Adatta ai principianti
#7,777 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Inizia in engine/src/program/generate.cpp, alla condizione adaptive-tier segnalata intorno alla riga 15138; poi leggi adapt() intorno alla riga 15502 e la configurazione di graph_hits/profile intorno alla riga 11124. Riproduci il problema con --expert-cache e senza --expert-profile, quindi controlla la condizione esistente di --expert-profile-save per verificare la gestione prevista del profilo. Il lavoro è completato quando la stessa richiesta non causa più un segfault e il caso di profilo mancante viene gestito con un messaggio chiaro oppure lasciando disattivata l’adattazione.

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

Descrizione

Version: Strata v0.2.25, engine 0.1.73-metal (the released binary; also a self-built one from the v0.2.25 tag)
Hardware: Mac Studio, Apple M5 Ultra, 96 GB unified memory, macOS 27

What happens

A hand-written run config that has --expert-cache N but no --expert-profile starts fine, then the engine dies with SIGSEGV on the first request (the server answers 503):

strata metal: crashed (signal 11 at address 0x0) - the call stack:
0   strata   metal_crash + 64
1   libsystem_platform.dylib   _sigtramp + 56
2   strata   std::__thread_proxy<... main::$_341> + 104
Repro

The released engine with a Qwen3.8-Flash-Next IQ3_S pack, the usual arguments minus --expert-profile:

--pack <pack> --native <shard1> --ple-gguf <shard2> --expert-cache 64 --prefill auto --max-context 262144 --mmap-experts

Any chat request then crashes it. Adding --expert-profile terminal/data/expert-profile.bin (or --adapt-swaps 0) makes it run.

Cause

With a RelWithDebInfo build and the faulting pc from the signal context, the crash is in adapt() at engine/src/program/generate.cpp:15502 (v0.2.25):

const int32_t* r = host_res.data() + l * g.n_expert;
...
if (r[e] < 0) {            // host_res is empty -> null read
  • host_res is only built when graph_hits is true, and graph_hits needs !profile.empty() (line 11124).
  • The adaptive tier is switched on at line 15138 without looking at it:
    if (o.adapt_every > 0 && o.adapt_swaps > 0 && !all_experts_resident && live_gpu_slots > 0) drive.d.usage.assign(...)
    (all_experts_resident is false when host_res is empty).
  • So with no profile and a cache of at least one slot, the first adapt round reads a null table.

--expert-profile-save already checks for this case (drive.d.usage.empty() || host_res.empty() -> "needs ... --expert-profile"), the tier itself does not.

Suggested fix

Either && !host_res.empty() on line 15138 (the tier stays off, one log line saying it needs --expert-profile), or refuse the start with that message. setup never hits this because it always passes a profile (the neutral one for other shapes), so it only bites hand-written configs.

Lingua principale
C++
Stelle
11.6k
Fork
1k
Merge medio
6g 2h
PR unite (30g)
21

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 Niko1221/Strata

Tutte le issue di Niko1221/Strata

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.