mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #31] Engine freezes mid-generation and never recovers: generated counter static, GPU spinning at idle power (~69 W), cancel ineffective (4 captures in 2.5h) #16
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Zauberio on GitHub (Sep 27, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/31
Symptom
Engine (v0.1.9, Windows build) freezes mid-generation and never recovers. Four captures in ~2.5 hours of sustained benchmark load (streamed chat completions, temperature 0.0). Same core signature every time; the process stays alive.
Common signature (all 4 captures)
/status:busy: true, phasethinking,generatedstatic across minutes of sampling,elapsed_sclimbing,tokens_per_sdecaying, tail shows mid-output text (no error)--kv q4_0 --kv-resident 32768 --max-context 262144, ~5059 resident experts, READY ctx=262144Captures
#1 — 5-task code-fix benchmark, task 5 (
add_months): froze atgenerated: 218, elapsed 1573 s, tps 0.1, GPU 100 % @ 69 W. Exact replay of the same 5 tasks on a fresh serve: all 5 passed (the frozen one in 5 s) → not deterministic by content alone.#2 — HumanEval
how_many_times: model entered degenerate repetition ('ababab…' thousands of times), generated 91058 tokens at ~105 tok/s, then froze:/statust0:generated 91058, elapsed 1021.2, tps 89.3/statust+90s:generated 91058(identical),elapsed 1111.2, tps 82.0#3 — fivebugs task: froze at
generated: 13(very early in generation), detected by our watchdog after 3 consecutive 2-min samples.#4 — HumanEval
sort_arrayrepair (prompt 399 tok): froze atgenerated: 130, elapsed 280 s, tps 0.5, GPU 100 % @ 69.44 W. Last healthy request before it:prompt 284 tokens … 562 generated in 7037 ms (79.9 tok/s). Nothing in the engine log between — the wedged request simply never completes.Frequency / pattern
Configuration
--pack <pack> --native <shard1> --ple-gguf <shard1> --expert-profile <bin> --expert-cache auto --prefill 2048 --spec 4 --spec-min-p 0.5 --mtp <dir> --max-context 262144 --kv q4_0 --kv-resident 32768 --pool-workers 8 --vram-reserve-mib 800KV streaming: 32768 of 262144 cells per QSA layer in VRAM, K/V in 1.69 GiB of pinned RAM;expert cache 5059 slots, 8.21 GiB;707 MiB VRAM free;READY ctx=262144Suspected surface
--kv q4_0with--kv-resident 32768/ KV streaming (new in this setup today) or an interaction with--spec 4speculative decoding. Happy to run targeted A/Bs (e.g. q8_0 KV, spec off) against the same workload if useful.Ask
Before I run long A/Bs: is there any known wedge/deadlock class in this area (0.1.10 engine-robustness work?), and is there a diagnostic command (or a signal / watchdog hook) that could tell us where the arena/threads are stuck when it happens? Full
/statusdumps, GPU samples and engine logs for all four captures available on request.@Zauberio commented on GitHub (Sep 27, 2026):
Update from the reporter after digging into the release history:
We realized we were still running the v0.1.9 engine (we compared digests: v0.1.9's
strata.exe=a5771e02…, v0.1.10's =47d8d357…, unchanged in v0.1.11). The engine has now been updated to the v0.1.10/0.1.11 build and we're re-running the same benchmark workload against it.Two questions while that runs:
/statusdumps, GPU samples and engine logs for each capture are available — happy to provide anything that helps.Config on retest is unchanged (
--kv q4_0 --kv-resident 32768 --max-context 262144 --spec 4, Swift 1.5 IQ3_XXS). If it still reproduces on the current engine I'll follow up with a fresh capture, and I can run targeted A/Bs (e.g.--kv q8_0, spec off) if you'd like to narrow the surface.@Lufen34 commented on GitHub (Sep 27, 2026):
might be same issue as mine : https://github.com/Niko1221/Strata/issues/29
@Niko1221 commented on GitHub (Sep 27, 2026):
Retry now. New version pushed.
@Zauberio commented on GitHub (Sep 27, 2026):
Thanks — installing 0.1.12 now and re-running the same sustained workload (164-task HumanEval + a 4h agentic hunt) against it.
For completeness: we captured one more occurrence on the 0.1.10/0.1.11 engine before switching (43 min into the load, same signature —
generatedcounter static, GPU pegged at low power, workers idle). The engine log showed two 32768-token runaway generations shortly before the stall; the frozen request was the next one after the second runaway. Full logs kept if useful.Will report how 0.1.12 fares — and if the built-in 120 s watchdog fires, you'll get the exact
no progress for 120 s ...line from us too.@amonpaike commented on GitHub (Sep 27, 2026):
git pull
setup.sh starts the model , but it doesn't seem to recompile the engine (on Linux).
@Niko1221 commented on GitHub (Sep 27, 2026):
@amonpaike thanks, that was a real bug in setup. A locally compiled engine was only marked as "compiled here", so later runs never compiled it again. After a
git pullon Linux (where there is no ready-made engine), setup kept starting the old binary. That also means Linux installs never got the v0.1.12 pool fix.Fixed on main (
b742ff9):git pullchanges them, it compiles the engine again before starting the model. Only the changed files are rebuilt, so this takes a few minutes, not the full first build.To update:
git pull, then./setup.sh. Your current engine has no fingerprint yet, so this first run always recompiles it once.@Zauberio thanks for the detailed captures. Your early freezes (13, 130 and 218 tokens) match the expert-pool race fixed in v0.1.12 (details in #29). I'm looking forward to the 0.1.12 run.
On the runaway generations (the
abababcapture and the two 32768-token runs):--kv-residentand with the whole KV in VRAM."presence_penalty": 1.0(the default window is the last 64 tokens;penalty_last_nraises it, up to 4096). For every client, add it to thesamplingblock of yourstrata-*.json:"sampling": {"presence_penalty": 1.0}.max_tokenscap also keeps a runaway from eating the slot.Update me if I can close the issue.
@Zauberio commented on GitHub (Sep 27, 2026):
Retry update on 0.1.12: the built-in watchdog works — and we caught it live, with the exact line you asked for.
During a sustained 164-task run (single slot, no restarts), one request stalled after ~45 min of continuous load. 120 s later, the engine log had:
strata serve: no progress for 120 s during a request (verify window: the CPU experts of layer 9) - stopping the engine so the server starts it again (issue #29)The engine stopped itself, the server reported
the engine stopped unexpectedly (exit code 3221226505); the next request restarts it, and the run continued transparently — one task lost instead of the whole session. Before this, the same event hung everything for 10+ minutes and needed an external watchdog to intervene.So the recovery path is rock solid. The underlying race still fired once in ~65 min of sustained load; the "(verify window: the CPU experts of layer 9)" hint may help narrow it. We're keeping the same workload running (4 h agentic session next) and will report if the watchdog trips again, with log segments.
Catching up on your reply — it landed while we were mid-switch; read now, thanks for the detail:
presence_penaltyper request (env-switched, validated with tests), and the box config is getting"sampling": {"presence_penalty": 1.0}at its next restart — the current 4-hour agentic run finishes undisturbed first this time. If the penalty absorbs the loops as expected, most of our remaining HE+ non-passes (7 of 14 were our client-side loop-guard kills) should become earlier, cheaper stops.abababcase all look like model looping at temp 0, not an engine fault, and your KV-streaming check matches what we saw. Themax_tokenscap is already in place for benchmark runs — that's what those two runs hit — so a runaway can't eat the slot indefinitely.verify window: the CPU experts of layer 9), so the expert-pool race still has a residual window under heavy load, even though recovery is now invisible. The 4-hour agentic run is in flight; give us until it finishes (~03:20 local) and we'll post the final count of watchdog trips plus the full night's numbers. If that comes through clean, that's our green light from this side.@Niko1221 commented on GitHub (Sep 28, 2026):
Thanks for catching it live. That one line narrows it down a lot.
What your line tells us: the engine stopped in "verify window: the CPU experts of layer 9". The CPU expert pool has its own 60 s stall check since 0.1.12, and it did not fire before the 120 s watchdog did. So the host thread was not stuck in the pool's own waits. It was inside something without a time limit during that step: an expert job, or a call into the CUDA driver. The line alone can't say which.
v0.1.13 (out now) makes the next occurrence say it:
no progressline there is now a stall report. It shows:It is printed twice, 2 s apart.
strata-stall-<pid>.dmp(a few hundred KB, every thread's stack) in the engine's folder. Please attach the report and the .dmp: with the symbols published alongside the release (strata-windows-x64-symbols.zip), they show the line each thread was on.session is up (engine 0.1.13), so we can tell which engine ran.What I tested here: 2 hours of sustained single-slot load shaped like yours: coding prompts at temperature 0 with reasoning, and a long document every 15th request. The setup:
--kv q4_0 --kv-resident 32768 --max-context 262144 --spec 4;--pool-workers 8does on an 8-core CPU.Result: 517 requests with no stall, no error and no broken answer. So it doesn't reproduce here, and the stall report from your box is what will pin it down.
One suggestion meanwhile:
--pool-workers 8on an 8-core CPU gives one worker no core of its own (the engine keeps the first core for the host thread). The default (leave the flag out) uses every other physical core, and it's what everything is measured with.Also in 0.1.13: long prompts are about twice as fast (32K prompt on a 12 GB card: 572 -> 1,290 tokens/s with Q2_0, 383 -> 1,208 with IQ3_S). And on Linux,
git pull+./setup.shnow recompiles the engine (@amonpaike). Update withSTART-HERE.bat.@Zauberio commented on GitHub (Sep 28, 2026):
Thanks — that breakdown is exactly what we needed. The timing worked out too: we updated to 0.1.13 this morning (boot log shows
session is up (engine 0.1.13)) and the same sustained workload is running on it right now — 164-task HumanEval, temperature 0 with reasoning,--kv q4_0 --kv-resident 32768 --max-context 262144 --spec 4, single slot, plus our shorter fivebugs legs. The matching symbols are already staged. If it stalls, the full report +strata-stall-<pid>.dmplands in this thread.On
--pool-workers: noted — that's our exact case (8-core 9800X3D). We inherited--pool-workers 8from the pre-0.1.5 config and carried it forward since. The current run keeps it so it stays comparable to our earlier legs; the next one uses the pool default, and I'll report stall behavior plus any throughput difference.One data point from the 0.1.12 retest, for what it's worth: the stall class was absent from the full retest — a 164-task sweep plus a 2-hour agentic session at 70–120K-token contexts, zero stall events (the one watchdog trip you already saw was at ~45 min into the first run; everything after it was clean). What did not change is the model-looping tendency at temperature 0 — roughly 5–7 doom-loop kills per 164 tasks on both KV modes — so your presence_penalty guidance is being adopted on our side.
If you can keep the issue open a little longer: we'll either deliver a stall report from the repro rig or confirm the retest stayed clean across more sustained load. Either way you'll get the data.
@Zauberio commented on GitHub (Sep 28, 2026):
First stall caught on 0.1.13 — the new report did exactly what it promised. Full report + thread-stack dump (
.dmp) as release assets: https://github.com/Zauberio/strata-stall-captures/releases/tag/stall-20260928The report's headline (stall ~46 min in, one request):
stage "verify window: the CPU experts of layer 27" for 60 s; 14 layers served since the last finished stepexpert pool: 24 of 24 jobs claimed, 24 done; 7 of 7 workers parked, 7 sleeping; host idle for 60209 msverify window: 4 tokens at position 670, host at layer step 28; the GPU rang 28; flags: served 27, plan (A) 28, copies (B) 27memory: 37677 MiB resident, 58918 MiB committed, 1944 MiB RAM available; 36075540 page faultsSo: not the pool — every worker parked, everything completed. The host was waiting on the GPU side of the layer 27→28 step while the GPU had already rung 28 — closest to the "call into the CUDA driver" branch from your analysis. The stacked dump should say exactly where. The 1.9 GiB RAM-available figure sits in the same snapshot in case it's page-related.
Impact note for the 60 s cutoff: the self-stop and auto-restart worked, but the cold engine reload afterwards took ~15 min and the remaining 74 requests of the run errored during it. For sustained benchmarks that reload is the expensive part.
Context for this one: it ran your suggested
--pool-workersdefault (flag removed per your note). One stall in ~46 min at layer 27. Starting a clean rerun now for a fair pool-default vs pool-8 comparison; I'll add anything it shows.@Zauberio commented on GitHub (Sep 28, 2026):
Second occurrence, ~21 min into the rerun — and it sharpens the picture. Report + dump: https://github.com/Zauberio/strata-stall-captures/releases/tag/stall-20260928-layer1
stage "verify window: the CPU experts of layer 1" for 60 s; 0 layers served— fully stopped this time (vs 14 = slow on the first)24 of 24 jobs done; 7 of 7 workers parked, sleeping; host idle 60 s+verify window: 3 tokens at position 227, host at layer step 2; the GPU rang 2; flags: served 1, plan (A) 2, copies (B) 1memory: 39620 MiB resident, 58812 MiB committed, 8582 MiB RAM availableTwo points vs the first capture:
Field note in case it helps your side: both of these landed while running without
--pool-workersper the suggestion. Today's tally on this box: 2 stalls in ~85 min on the default pool vs 1 stall in ~4h40m with--pool-workers 8(that one is the layer-9 stall you already have). Small samples, no strong claim — but we reverted to--pool-workers 8for the standing config, and we can run the default again any time if you want more data.@Zauberio commented on GitHub (Sep 28, 2026):
Third stall report on 0.1.13 — and it comes with our best repro candidate so far.
Report + dump: https://github.com/Zauberio/strata-stall-captures/releases/tag/stall-20260928-1122
The stall (11:22, layer 1, 0 layers served, 8/8 pool workers parked, host idle 60 s+) hit the same task as the 0.1.12 stall: HumanEval/47 (
median), task 48 of 164. Same task, same position, two different engine versions, two different pool configs.This morning's stall-free run on the same task shows why it's special: it produced 65536 output tokens — two consecutive generations into the 32768 max_tokens cap (first attempt + one repair) — all of it a degenerate numeric cycle (period 2 tokens, 119 repetitions, loop score 0.991), 525 s, then failed. So on this box the task means long degenerate generations, and on 2 of 4 runs the engine stalled during it — matching the "two 32768-token runaways shortly before the stall" pattern from my earlier note.
Cheapest repro attempt on your side, if useful: that exact prompt, temperature 0, max_tokens 32768, let both the first and the repair generation run through a full cap. Prompt + full metadata attached:
https://github.com/Zauberio/strata-stall-captures/releases/tag/he47-repro-20260928
Separately, for the record: today's stall density on this box is up (3 in ~2.5 h across configs, vs a stall-free ~3.5 h stretch last night). We're now also looking at the large-pages / pinned-arena angle from #42 plus today's unusually heavy engine restart churn as contributing state. Will report what we find.
@Niko1221 commented on GitHub (Sep 28, 2026):
Thank you - the dumps were exactly what was needed, and they point somewhere I would not have guessed.
(The third capture, HumanEval/47, shows the same thing; thanks for the repro - long degenerate generations mean many more verify windows, so more chances to hit it.)
Where it stops. In all three, the host thread is inside
cudaMemcpyAsync, waiting for a lock inside the NVIDIA driver (RtlAcquireSRWLockSharedin nvcuda64), while one of the driver's own threads is busy in nvcuda64. The call comes from the verify window's DMA path (Verifier::fetch_dma, verify.cpp:922): with a native pack (your IQ3_XXS) the engine copies the missed experts with the copy engine, issuingcudaMemcpyAsync+cudaLaunchHostFuncfrom the host inside a verify window - while the GPU spins on the flag those very copies raise ("the GPU rang 28; copies (B) 27"). The pool and the workers are idle, as the report said. Q2_0 has always used a copy kernel instead (no host CUDA call inside the window), which is why none of our Q2_0 soaks ever hit it, and IQ3_S on this 64 GB machine stayed clean for 2 hours (517 requests) - it needs something your machine has. It is not paging itself: the page-fault counter moved by one in the 2 s between the report's snapshots; but a nearly full RAM (1.9 and 8.5 GiB available) plausibly keeps the driver's own threads busier, which is where the host was waiting.The fix (0.1.14): the copy kernel is now the default for every pack. Measured on IQ3_S: 45.3 -> 44.8 tok/s (8 requests), so ~1%.
--pcie-mode dmakeeps the old path. Update withSTART-HERE.bat; on an engine you keep at 0.1.13,--pcie-mode kernelin the config's args does the same.The 15-minute restart: the log line after the restart says
loaded 39.97 GiB at 0.04 GiB/s(normally 2-3 GiB/s). The first stall report shows 1.9 GiB of RAM available: with a 40 GB arena on 63 GB, the reload was paging. More headroom (fewer other processes during the benchmark, or a smaller pack) keeps a restart at ~20-30 s.--pool-workers 8vs the default: fine either way; the stall was not in the pool (all workers parked in all three dumps), so the difference in your tally is chance. Large pages (#42, thanks to @pipeob0) are in 0.1.14 as well.Closing this with 0.1.14. If it happens again on 0.1.14, please reopen it with the stall report and the dump.
@Zauberio commented on GitHub (Sep 28, 2026):
Validation report on the closing fix — running your 0.1.14 on the original box.
Stalls: gone. Three HE+ runs (164 tasks each) across ~3.5 h, q4_0 and int8 KV modes, max context, sustained single-slot load: zero stalls, zero watchdog trips — previously this workload was freezing every 20–45 min. The
fetch_dmafix holds here.Scores on 0.1.14 (both legs, same everything else — penalty, pool-8, prefill auto):
On your notes, for the record:
~50 MB/s) happened while a WSL VM was squatting 15.5 GB VRAM and ~10 GB RAM on this box. It's been evicted; reloads should return to your 20–30 s figure on the next cycles.large pages refused ... error 1450, which per @pipeob0's caution is the expected pool-exhaustion state right after an engine kill. Will re-check on a settled machine;STRATA_NO_LARGEPAGESnoted as the switch.--pool-workers 8vs default: understood, chance — staying on our known-good 8.Thank you for turning the dumps into a fix this fast — the trace (driver lock inside the DMA copy while the GPU spins on the very flags those copies raise) is a much better explanation than we ever had. If anything recurs on 0.1.14, it comes back here with a fresh dump.
@pipeob0 commented on GitHub (Sep 28, 2026):
Two data points from the other 16 GB VRAM / 64 GB RAM box (Ryzen 7 5700X3D, RTX 5060 Ti at PCIe 4.0 x8, 40 GB arena), now on 0.1.14 — both about the large-pages side, since @Zauberio landed on it.
1.
error 1450right after a restart is expected, not a privilege problem. On this account the privilege is genuinely fine: probingVirtualAlloc(MEM_LARGE_PAGES)directly, 4000 separate 2 MB chunks allocate back to back, and a single allocation of 40 GB succeeds. What produces 1450 here is starting a new engine while the previous one's pinned large pages have not been released by the driver yet — the log then readslarge pages refused for <bytes> B (GetLargePageMinimum=2097152, VirtualAlloc error 1450), and the start after that reportslarge pages (2097152 B). That is why #42 prints the byte count and the raw code and stopped blaming the privilege: 1450 = pool exhausted, 87 = size not a multiple, 1314 = privilege off. Three different things, and the old single message conflated them.2. The x8 link is a real constraint, and 0.1.14's probe reads it correctly. Here it prints
PCIe probe: 13.7 GB/s host->device -> pcie_frac 0.29. Measured on 0.1.14 with the copy-kernel default,--pcie-frac 0.30beats0.55by ~17% in ms/round on this card (6/6 interleaved pairs, numbers in #44) — the engine's own line goes from 3.30 to 1.60 distinct experts per layer read over PCIe. So the share that is right for a x16 box is roughly twice what a x8 box wants.For the record: a few hours of sustained load on 0.1.14 here, no stall and no watchdog trip. Nothing to add to the dump analysis — the driver-lock-inside-
cudaMemcpyAsyncfinding is the same shape as the "GPU rang 28, copies (B) 27" signature in all three of your captures.