mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2255] conversation cache: once every slot holds a pinned prefix, nothing is parked any more ("skip parking ... exceeds available budget") #898
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#898
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 @bennizone on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2255
Version: 0.1.42 (single RTX 3090, Linux, CUDA).
evict_oldest()is unchanged onmain(a0116b27, 2026-10-12).Setup: Home Assistant's voice assistant talks to Strata through an OpenAI-compatible gateway that adds
strata_prefixto every request, so the system prompt + tool list (~6–10K tokens) stay pinned.--conversation-cache-mib 22528 --conversation-cache-slots 32,"parallel": 2. Other clients (agents, long-context jobs) share the engine.What happens: every Home Assistant conversation carries the pinned checkpoint in its chain, so
SavedConversation::pinned()is true for all of them.make_room()→evict_oldest()only evicts entries that are not pinned. Once all 32 slots held pinned conversations,evict_oldest()returned false and every attempt to park was refused:(315 times in the ~2,000 log lines after the last successful park, no park in between, snapshots from 225 to 3,806 MiB alike, while the parked bytes were below the 22 GiB budget and ~11 GiB of RAM were still available — so the slot count with only pinned entries, not the byte budget, refused them). The last successful park before that read
parked=32 ... evictions=309. Effects: a conversation only resumed from the cache while it was still the active one; everything else was read again — ~4 s instead of ~0.4–0.8 s for a 7K voice request, and three long-context requests (186K–202K tokens) were read from token 0 (~90–98 s each).Relation to #1559: #1559 retires stale pins when a new prefix replaces the old one. In our log the pin position changed several times (4578, 5751, 5970, 7250, 6484 tokens — the Home Assistant prompt changes when entities are renamed or exposed), so stale pins probably contributed, and #1559 may already fix part of what we saw; I have not run with #1559 applied. What #1559 cannot cover: a client with a stable prefix. Every parked conversation then holds the current pin, #1559 keeps them all pinned, and once
slotsconversations are parkedevict_oldest()still returns false. This patch is for that case and is independent of #1559.Proposed fix (minimal): when only pinned entries are left, evict the oldest pinned one as long as another holder of a pin remains (the newest is kept), so the shared prefix stays parked and findable. Note that
make_room()callsevict_oldest()in a loop, so a very large incoming snapshot can clear all pinned entries but the newest one, not just one.(The comment in
make_room()— "with only pinned ones left the new image does not fit" — would need the same update.)Test added to
src/core/conversation_cache_test.cpp(fails on 0.1.42 at "a fourth pinned one still parks", passes with the change; the existing pinned-prefix checks — a single pinned entry is never evicted — still pass, 4,219 checks):In use since the change (same machine and clients, ~35 min incl. a 50-request Home Assistant benchmark and a parallel 24K–56K agent conversation): no
skip parkingline (0 vs. 315 before);parked=32,evictions=36; 54 of 57 Home Assistant requests resumed ~10,459 of ~10,480 tokens from the cache. Short observation window, and the log does not mark which evictions were pinned ones.Only tested with CUDA on Linux; the change is header-only and backend-independent. Happy to open a PR if that is preferred.
@nickzeigler commented on GitHub (Oct 17, 2026):
Same issue here, on 0.1.44.1, and it is still present on main at v0.1.45 (
477ac13).Setup: single RTX 3090, 64 GB RAM, Linux, Docker. Qwen3.8-Flash-Next IQ2_XS, "parallel": 2, --conversation-cache-mib 6144 --conversation-cache-slots 8 --conversation-cache-min-tokens 3000. A voice bot pins its ~4.2K-token system prompt with "strata_prefix": {"messages": 1}. A coding agent and Open WebUI share the engine.
Once the cache reaches parked=8, every park is refused and nothing is evicted:
The 297 MiB and 157 MiB snapshots are far below the 6 GiB budget, so it is the slot count with only pinned entries left, as you describe. Under load, 13 of 31 bot requests (42%) read their whole prompt from token 0, and 3 of 38 in real calls.
Reproduced against the v0.1.45 header with a standalone test: ConversationCache(1 GiB, 8 slots), put 8 conversations that each hold a pinned checkpoint at the same shared prefix plus their own deeper turn checkpoint. A 9th put() is refused (pinned or not), with size=8 and evictions=0.
+1 for your evict_oldest() change (keep the newest pin holder, evict the oldest pinned one). One extra ask: a log line when a park is refused because only pinned entries are left, instead of "exceeds available budget", which reads like a RAM or budget problem.
@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.