mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1072] Vision: >64 unique images can evict .sve files still referenced by the current request #461
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#461
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 @jinyu0 on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1072
Summary
A vision request containing more than 64 unique images can fail with
FileNotFoundError.Vision.encode()evicts and deletes the oldest cached.svefile once the cache exceeds 64 entries, butService.prepare()may still hold that file path in the current request'sencodedlist.write_temporary()later tries to read the deleted file.Reproduction
Expected
The request should succeed, or return a clear validation error if more than 64 images per request are intentionally unsupported.
Actual
The server raises:
The prompt was still below the configured context limit when this occurred.
Environment
Likely cause
The current cache eviction logic removes the oldest file immediately:
while the current request later combines all paths returned by
Vision.encode().It looks like active-request embeddings need to remain alive until the combined request embedding has been written, with cache eviction happening afterwards (or active entries being pinned).
@yeungyim commented on GitHub (Oct 6, 2026):
Confirmed on a different environment, with a smaller and fully deterministic reproduction, and a one-line fix that holds up in testing.
Environment: Linux (Ubuntu), 2x RTX 3090 layer split, Qwen3.8-Flash-Next IQ3_S,
--resident-experts --vision, context 262144, Python 3.14.Reproduction: no long history needed
The trigger is the image count of one request, not of the session, so a single call reproduces it. Sent 70 distinct 64x64 PNGs as
image_urlparts in one message:ls /tmp/strata-vision-*/ *.sve | wc -lsat at exactly 64 afterwards — the cache limit, not the image count. The same request succeeds unchanged after the fix below.The client does not see the traceback. It sees the connection dropped:
That is worth knowing for triage: from an agent or a GUI the symptom looks like "the server died", not like a vision error.
Why it is deterministic rather than a race
prepare()builds the whole list before it touches any of them:Each
encode()call returns a path and may evict an earlier entry of that same list once the cache passes 64, so with more than 64 images in one request the loss needs no concurrency at all. (Concurrency widens it, it does not cause it.)A second, independent way in, for requests under the limit:
imagesis not "the new pictures", it is every image the template writes a pad for, so a conversation that resends its history reaches the same state with one new image per turn — which is how the reporter's agent hits it.Fix tested here
Dropping the entry must not unlink its file while a request can still hold the path. Removing just the
unlinkfixes it:RemoteDisconnected+FileNotFoundError.svefiles afterThe cost is that evicted files now live until the encoder exits (
shutdown()rmtree's the directory), sotmpfs/tmpgrows by roughly 1.8 MB per distinct image for the life of the server. A bounded version would reap files that are out of the cache and older than any in-flight request; pinning the entries a request is using, as the report suggests, is cleaner still ifprepare()can pass them down.Happy to test a proposed patch here on the 70-image case, and on a longer mixed run, if that helps.
@Niko1221 commented on GitHub (Oct 7, 2026):
Fixed in 0.1.40.2: a request keeps the encoded files of its own images, so more than 64 unique images in one request no longer deletes a file the request still reads (the cache shrinks back on the next insert). The large-image downscale from #1014 is not part of this fix.