[PR #2286] [CLOSED] fix(vision): retain image ownership through request preparation #3961

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2286
Author: @Tsury
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/native-vision


📝 Commits (1)

  • 0b4d4e8 fix(vision): retain image ownership through request preparation

📊 Changes

3 files changed (+433 additions, -65 deletions)

View changed files

📝 serve/server.py (+103 -64)
📝 serve/test_server.py (+46 -1)
➕ serve/test_vision_cache.py (+284 -0)

📄 Description

The current image cache keeps records during encode_all, but releases the service FIFO before preparing the combined embedding file. Another request can evict those files between encoding and stat/copy. A refused request with more than 64 cached images can also leave the cache above its bound.

Keep the FIFO and a reentrant image batch lock through encoding, validation and combined-file copying. Defer eviction to the outermost batch's finally block. Preserve combined-file ownership and trim back to 64 afterward. Close encoder pipes during teardown and clean failed startup. On the specific native decoder refusal, retry once through the existing Pillow normalization path; conversion failures retain temporary-file cleanup.

Based on main a0116b2782a5b82622358c04a06496485d12b2d6. #1072/#1207 addressed retention during encoding; the stock source still exposes the interval through combined-copy. This PR covers that remaining ownership interval instead of duplicating the shipped encode_all change.

Validation: 20 focused model-free vision tests pass. The nine cache-lifetime methods fail on stock for eviction/copy ordering or failure-path bounds. Scheduled two-request races check the real cache and copy boundary, with no GPU/model. Existing image marker, temporary-file and shutdown checks pass. The normalization retry tests isolate protocol behavior; they do not qualify a new image decoder.

Command: python3 -m unittest serve.test_vision_cache serve.test_server.VisionDecode serve.test_server.ImageMarkers serve.test_server.VisionTempFiles serve.test_server.VisionShutdown.

No new device build, GPU campaign or deployment. The longer FIFO hold protects request ownership; its throughput cost is unmeasured.


🔄 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/2286 **Author:** [@Tsury](https://github.com/Tsury) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/native-vision` --- ### 📝 Commits (1) - [`0b4d4e8`](https://github.com/Niko1221/Strata/commit/0b4d4e8d3c236067dade353a4625352e0e7f437f) fix(vision): retain image ownership through request preparation ### 📊 Changes **3 files changed** (+433 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+103 -64) 📝 `serve/test_server.py` (+46 -1) ➕ `serve/test_vision_cache.py` (+284 -0) </details> ### 📄 Description The current image cache keeps records during encode_all, but releases the service FIFO before preparing the combined embedding file. Another request can evict those files between encoding and stat/copy. A refused request with more than 64 cached images can also leave the cache above its bound. Keep the FIFO and a reentrant image batch lock through encoding, validation and combined-file copying. Defer eviction to the outermost batch's finally block. Preserve combined-file ownership and trim back to 64 afterward. Close encoder pipes during teardown and clean failed startup. On the specific native decoder refusal, retry once through the existing Pillow normalization path; conversion failures retain temporary-file cleanup. Based on main `a0116b2782a5b82622358c04a06496485d12b2d6`. #1072/#1207 addressed retention during encoding; the stock source still exposes the interval through combined-copy. This PR covers that remaining ownership interval instead of duplicating the shipped encode_all change. Validation: 20 focused model-free vision tests pass. The nine cache-lifetime methods fail on stock for eviction/copy ordering or failure-path bounds. Scheduled two-request races check the real cache and copy boundary, with no GPU/model. Existing image marker, temporary-file and shutdown checks pass. The normalization retry tests isolate protocol behavior; they do not qualify a new image decoder. Command: `python3 -m unittest serve.test_vision_cache serve.test_server.VisionDecode serve.test_server.ImageMarkers serve.test_server.VisionTempFiles serve.test_server.VisionShutdown`. No new device build, GPU campaign or deployment. The longer FIFO hold protects request ownership; its throughput cost is unmeasured. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:32:02 +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#3961
No description provided.