mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3372] [CLOSED] [Engine] serve: recreate the vision encoder's work dir when a temp cleaner removed it #4596
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#4596
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3372
Author: @smallmj
Created: 10/20/2026
Status: ❌ Closed
Base:
main← Head:fix/vision-workdir-recreate📝 Commits (1)
698f3afserve: recreate the vision encoder's work dir on a start when a temp cleaner removed it📊 Changes
2 files changed (+62 additions, -0 deletions)
View changed files
📝
serve/server.py(+5 -0)➕
serve/test_vision_dir.py(+57 -0)📄 Description
[Engine] — the title above starts with the area.
Problem and result
An idle encoder's work dir (
%TEMP%\strata-vision-*) sits empty and unheld in the temp directory for as long as the model stays unloaded, and Windows' Storage Sense (or any temp cleaner) removes it there. Every later start then failed on the encoder's cwd with[WinError 267] The directory name is invalid, on every client retry, until the whole server was restarted:work_dir()runs once at the server's start andrestart()reuses the stale path.After the fix,
Vision._start()recreates the dir (and drops the encoded-image cache, whose files lived in it) before either the GPU or the CPU-fallback reader is spawned, so an unload/load cycle survives an external removal of the directory.Related discussion
#3370 (the full evidence chain: production timeline, ruled-out causes, minimal reproduction).
Approach
The check lives in
_start, the wrapper, so both the GPU reader and the CPU fallback start against an existing dir. The cache is dropped along with the dir because the cache-hit branch ofencode()returns paths without checking they exist — stale entries would hand the engine paths into a directory that no longer exists. No compatibility effects outside the broken case: a dir that exists is left untouched, andwork_dir()is the same #480-selected space-free path as before.Validation
Passed:
python3 -m serve.test_vision_dir— both cases (removed dir recreated + cache dropped; intact dir kept with its cache), ate88ee39d+ this patch, Ubuntu, CPython 3.12python3 -m serve.test_vision_busy— the existing vision-start tests, no regression (4/4)py_compileclean; the load-after-idle path had been failing daily before the fixFailed:
Not run:
Limits
The recreated dir is a new directory: anything holding a path into the old one goes stale. The server itself holds no such paths (the cache is dropped with the recreation), and the encoder is spawned fresh in the new dir — so nothing inside the server can observe the switch.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.