[PR #3041] [CLOSED] [Other] Serialize conversation-cache log polling #4417

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3041
Author: @oscarlius
Created: 10/18/2026
Status: ❌ Closed

Base: main ← Head: fix/conversation-cache-poll-lock-20261018


📝 Commits (1)

  • 6cc2030 fix(serve): serialize conversation-cache log polling

📊 Changes

2 files changed (+95 additions, -0 deletions)

View changed files

📝 serve/server.py (+6 -0)
📝 serve/test_monitor.py (+89 -0)

📄 Description

Problem and result

Concurrent /metrics readers could read the same conversation-cache log range and replay an event. This change serializes access to the shared log cursor, so direct and HTTP metrics readers count each event once.

Closes #3039.

Approach

Guard the existing log-poll operation with the cache object's lock and add direct-reader and local loopback /metrics concurrency regressions. Cache parsing and native inference behavior are unchanged.

Validation

Rebased on upstream main e88ee39d1d6be6e3364183af3b39b62a7ed6f211 (0.2.0-beta); tested candidate 04796fa0427beaa6b8628d6e2ab914c7059ca8c0 on Windows, Python 3.14.3. Each test command starts a fresh local process.

Passed:

  • py -3.12 -m ruff check --output-format json serve/server.py serve/test_monitor.py (Ruff 0.2.1): 10 existing diagnostics, same as unmodified main; zero new diagnostics.

  • python -m unittest -v serve.test_monitor serve.test_prometheus — 18 tests passed.

  • python -m py_compile serve/server.py serve/test_monitor.py.

  • git diff --check e88ee39d1d6be6e3364183af3b39b62a7ed6f211..HEAD.

Failed:

  • With the exact base production file restored, the direct concurrency test replayed the park event twice. The initial two-test run also had one environment error before the local regex dependency was installed. The subsequent fresh loopback HTTP /metrics red test failed as expected with (parks, restores) = (2, 0) instead of (1, 0).

Not run:

  • No GPU, native backend, model download, or hardware inference test.

Limits

The proof covers concurrent Python readers, the repository mock engine, and a local loopback HTTP server. It does not exercise a real model process or hardware runtime.


🔄 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/3041 **Author:** [@oscarlius](https://github.com/oscarlius) **Created:** 10/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/conversation-cache-poll-lock-20261018` --- ### 📝 Commits (1) - [`6cc2030`](https://github.com/Niko1221/Strata/commit/6cc20305e2585b1dfb0b620a952aac1332f436dc) fix(serve): serialize conversation-cache log polling ### 📊 Changes **2 files changed** (+95 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+6 -0) 📝 `serve/test_monitor.py` (+89 -0) </details> ### 📄 Description ## Problem and result Concurrent `/metrics` readers could read the same conversation-cache log range and replay an event. This change serializes access to the shared log cursor, so direct and HTTP metrics readers count each event once. ## Related discussion Closes #3039. ## Approach Guard the existing log-poll operation with the cache object's lock and add direct-reader and local loopback `/metrics` concurrency regressions. Cache parsing and native inference behavior are unchanged. ## Validation Rebased on upstream main `e88ee39d1d6be6e3364183af3b39b62a7ed6f211` (0.2.0-beta); tested candidate `04796fa0427beaa6b8628d6e2ab914c7059ca8c0` on Windows, Python 3.14.3. Each test command starts a fresh local process. **Passed:** - `py -3.12 -m ruff check --output-format json serve/server.py serve/test_monitor.py` (Ruff 0.2.1): 10 existing diagnostics, same as unmodified main; zero new diagnostics. - `python -m unittest -v serve.test_monitor serve.test_prometheus` — 18 tests passed. - `python -m py_compile serve/server.py serve/test_monitor.py`. - `git diff --check e88ee39d1d6be6e3364183af3b39b62a7ed6f211..HEAD`. **Failed:** - With the exact base production file restored, the direct concurrency test replayed the park event twice. The initial two-test run also had one environment error before the local `regex` dependency was installed. The subsequent fresh loopback HTTP `/metrics` red test failed as expected with `(parks, restores) = (2, 0)` instead of `(1, 0)`. **Not run:** - No GPU, native backend, model download, or hardware inference test. ## Limits The proof covers concurrent Python readers, the repository mock engine, and a local loopback HTTP server. It does not exercise a real model process or hardware runtime. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:35:34 +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#4417
No description provided.