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

Open Beginner friendly
#7,777 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 4 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp

Research direction

Start in engine/src/program/generate.cpp at the reported adaptive-tier condition around line 15138, then read adapt() around line 15502 and the graph_hits/profile setup around line 11124. Reproduce with --expert-cache and no --expert-profile, then check the existing --expert-profile-save guard for the expected profile handling. Done when the same request no longer segfaults and the missing-profile case is handled with a clear message or by leaving adaptation off.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C++
Stars
11.6k
Forks
1k
Avg merge
6d 2h
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Niko1221/Strata

All issues in Niko1221/Strata

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.