Repository navigation
Description
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
This is about what the SSD conversation tier does when the spill disk stops answering. The tier itself works well for us: in an OpenCode-like pattern, a 377,705-token main conversation evicted by 6 short ones came back in 4.25 s from the tier (6,294 MiB read in 3.08 s; the background write took 7.87 s), against 336.5 s without it. In a real OpenCode session where 4 subagents ran at once (five conversations of up to 301K tokens taking turns on one engine; 18 evictions), conversations came back 6 times from the tier (1.2–2.5 s; one of them the 113K-token main conversation) and 4 times from the writer's RAM (0.5 ms), and no evicted conversation had to be re-read.
Our setup puts --conversation-spill-dir on a second consumer NVMe, not on the drive with the model, so that spill writes do not wear the system disk. With the default directory (<data>/conversation-spill), the spill disk is the model's disk, and a stall there stops the engine anyway. With a separate spill disk, the tier adds a new way for the engine to stop.
From reading the source (tag v0.2.20, engine 0.1.66; v0.2.18 and v0.2.19 behave the same), errors on the spill disk are handled gracefully, but a stall is not, and ends in abort().
Errors (handled well):
- A write that fails (ENOSPC, EIO, rename/fsync error) removes its temporary file.
spill_writelogs "could not spill …" and the conversation is dropped. The engine and the request go on (conversation_spill.hpp:320, with the write at:339; the writer thread'scatch (...)at:709). - A read-back that fails (I/O error, bad hash, RAM refusal) logs "… the prompt is read again", and the request re-reads its prompt (
generate.cpp:19468-19487).
A stall (not handled):
- The serve thread waits for the disk with no time limit in four places:
BackgroundWriter::push()blocks while one image is in flight and one is queued (conversation_spill.hpp:659). It is called from the evict sink (generate.cpp:14086).- The RAM gate's eviction loop calls
spill_writer->wait_idle()so that the freed memory shows up (generate.cpp:14319). Taking back an image the writer still holds also waits (generate.cpp:19424). - The RAM floor after a capture writes synchronously on the serve thread (
spill_put,generate.cpp:14400). - The read-back (
take_serial,generate.cpp:19468) reads a multi-GB file on the serve thread.
- None of these report progress to the stall watchdog.
- The spill write is called without
SessionWriteOptions::progress/phase(conversation_spill.hpp:339), and the read-back limits get noprogress. - Session SAVE/RESTORE does set both (
generate.cpp:18496,18599,18625), so it gets an explicit allowance throughsession_phase_limit_s.
- The spill write is called without
- The watchdog (
generate.cpp:16157-16213) callsabort()afterSTRATA_WATCHDOG_S(default 60 s) without a beat.- It extends this up to
STRATA_WATCHDOG_IO_S(default 600 s) only whilefile_tier_activity()grows. That counts major faults plusread_bytesfrom/proc/self/io, reads only (generate.cpp:1792). - So in cases 1–3, a spill write that makes no progress for 60 s aborts the engine. In case 4, a read that makes no progress at all aborts it after 60 s. A slow read that still moves data waits up to 600 s.
- It extends this up to
- After the abort:
- The request fails, and every parked conversation (RAM tier, and the SSD tier unless
--conversation-spill-persistis on) is lost. - The server starts a new engine on the next request, about 80 s on this machine for a 524K configuration.
- If the I/O is stuck in an uninterruptible sleep, the process cannot exit until the device answers.
- The request fails, and every parked conversation (RAM tier, and the SSD tier unless
Why a timeout plus fallback seems better than an abort here. The tier is an optimization: losing one parked conversation costs one re-read, while the abort costs every parked conversation and a restart. Today a stalled spill disk is treated like a stalled GPU, although the tier already has an answer for every other spill failure: drop the entry and re-read.
Possible approaches (opt-in or default, your call):
- Bounded waits on the serve thread.
- Give
push()andwait_idle()a deadline, for exampleSTRATA_SPILL_WAIT_S, default 30 s, below the watchdog. - On timeout, do not wait for the writer:
- In case 1, drop the conversation being evicted instead of queueing it.
- In case 2, count the in-flight image as not freed, and let the RAM gate refuse the park as it already does when no eviction can help.
- In case 3, skip the spill and drop the image (the existing "skip parking" line).
- Mark the tier unhealthy and close it, as
spill_readyalready does when fingerprinting fails, so that later evictions do not queue behind the stuck writer.
- Give
- Beats for the tier's own I/O. Pass
progressandphasetosession_file_write/session_file_readfrom the spill path, as SAVE/RESTORE do. A slow but moving disk then gets the same allowance as a session file, and only a truly stuck one trips the watchdog. - Read-back with a deadline. Run
take_serialwith a time limit, or on the writer thread with the serve thread waiting with a deadline. On timeout, log "the prompt is read again" and re-read, as on a read error. If the read thread stays blocked in the kernel, keep the tier closed from then on. - At least, say it in the docs: put the SSD tier on a separate drive only if that drive is reliable, because a stall of more than 60 s there ends the engine.
(1) and (3) together keep the server up through a stalled spill disk, at the cost of re-reads. (2) alone prevents false aborts on slow disks, but not on a hung one.
Related:
- [Engine] SSD conversation tier permanently deletes a snapshot when the read-back RAM gate refuses it #6658: a read-back refused by the RAM gate deletes the snapshot. Same theme: a transient condition destroys parked work.
- [Engine] Re-land the conversation-cache disk-spill tier (closed #5399) with the disk-restore erase-order fix #6276 / [Engine] Parked conversations spill to a disk tier instead of being dropped #5399: the disk-spill tier.
- [Engine] Automatic disk-backed conversation cache with size cap and auto-eviction, for subagent workloads on low-RAM machines #3891: the request for an automatic disk tier.
- [gfx1200, 2x RX 9060 XT layer split] prompt-read stalls (watchdog #29 aborts) + run-to-run prefill degradation: fresh prompts slow 3-4x mid-run, file tier re-reads 24-35 GB per request #1407: the I/O allowance for the file tier, which counts reads only.
Smallest steps or command that reproduce it
Not reproduced: we did not hang a disk on purpose. A way to verify the hypothesis would be to put --conversation-spill-dir on a device-mapper delay or flakey target (or a FUSE filesystem that blocks writes), then make a long conversation get evicted by short ones.
What we did run: strata serve with the SSD tier on a second NVMe, an OpenCode v2.0.24 session with subagents (18 evictions, 16 spills, 6 read-backs, 0 failures, no watchdog abort), and a synthetic evict-and-return test (numbers above).
Reproduction status
Unconfirmed static analysis (I read code or ran a scanner; I did not see it fail)
Strata version
Read on v0.2.20 (engine 0.1.66, 4920a3a). Running v0.2.18 (engine 0.1.64, 6e38f58), built from source.
Graphics card, memory and system
Ryzen AI Max+ 395 / Radeon 8060S (gfx1151), 96 GiB VRAM carve-out, ~30 GiB RAM, Linux, ROCm TheRock 7.14.1
Model, size and settings
Qwen3.8-Flash-Next UD-IQ4_XS, 524,288 context, pictures on, --conversation-cache-mib 12288, SSD tier at the default budget (32 GiB) on a second NVMe
Activity