[PR #555] [CLOSED] serve: a request's combined image file is deleted when the request is refused or never runs #2690

Closed
opened 2026-11-04 02:02:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/555
Author: @sergqwer
Created: 10/2/2026
Status: ❌ Closed

Base: main ← Head: pr/vision-temp-files


📝 Commits (1)

  • 80c2c7f serve: a request's combined image file is deleted when the request is refused or its answer never starts

📊 Changes

2 files changed (+97 additions, -6 deletions)

View changed files

📝 serve/server.py (+19 -6)
📝 serve/test_server.py (+78 -0)

📄 Description

prepare() writes a request's pictures into one req-<id>.sve in the vision directory (~10 MB a picture), and only run()'s finally deletes it. A request that never reaches run() leaves the file there for good. That covers:

  • a request refused after the write: EngineStarting (503), "no room to answer", "exceeds the context";
  • a client that disconnects between prepare() and run().

Clients retry 503s while the engine restarts, so the temp directory grows by a file per retry.

Fix (serve/server.py):

  • The combined file is written only after the checks that can refuse the request.
  • Its path is recorded before the write, so a half-written file is found too.
  • run() takes the path over as it starts.
  • A new Service.drop_embeddings(), called in the handler's finally, deletes a file no run() took.

Tests (VisionTempFiles): refusals for EngineStarting, no room and exceeds leave no .sve. So do, over HTTP, a 503, a 400, a client gone after prepare(), and normal requests. Without the fix 3 and 6 files were left. Serve tests: 174 OK (7 skipped).

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/555 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 10/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/vision-temp-files` --- ### 📝 Commits (1) - [`80c2c7f`](https://github.com/Niko1221/Strata/commit/80c2c7fd99867b30e7981a6aa77facf5318c426a) serve: a request's combined image file is deleted when the request is refused or its answer never starts ### 📊 Changes **2 files changed** (+97 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+19 -6) 📝 `serve/test_server.py` (+78 -0) </details> ### 📄 Description `prepare()` writes a request's pictures into one `req-<id>.sve` in the vision directory (~10 MB a picture), and only `run()`'s `finally` deletes it. A request that never reaches `run()` leaves the file there for good. That covers: - a request refused after the write: `EngineStarting` (503), "no room to answer", "exceeds the context"; - a client that disconnects between `prepare()` and `run()`. Clients retry 503s while the engine restarts, so the temp directory grows by a file per retry. **Fix** (`serve/server.py`): - The combined file is written only after the checks that can refuse the request. - Its path is recorded before the write, so a half-written file is found too. - `run()` takes the path over as it starts. - A new `Service.drop_embeddings()`, called in the handler's `finally`, deletes a file no `run()` took. Tests (`VisionTempFiles`): refusals for EngineStarting, no room and exceeds leave no `.sve`. So do, over HTTP, a 503, a 400, a client gone after `prepare()`, and normal requests. Without the fix 3 and 6 files were left. Serve tests: 174 OK (7 skipped). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2690
No description provided.