[PR #1588] [CLOSED] serve: answer the request that hit the READY timeout (#1527) #3546

Closed
opened 2026-11-07 14:42:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1588
Author: @nekomario28
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: fix-1527-ready-timeout


📝 Commits (1)

  • 978f649 serve: answer the request that hit the READY timeout (#1527)

📊 Changes

2 files changed (+114 additions, -4 deletions)

View changed files

📝 serve/server.py (+8 -4)
➕ serve/test_ready_timeout.py (+106 -0)

📄 Description

Fixes #1527.

STRATA_ENGINE_READY_S (the #1317 read timeout) kills an engine that never says READY, but the request that was loading it ended with no response — the RuntimeError raised in StrataEngine.__init__ matches none of the request path's handlers, so the connection closed unanswered (the reporter's curl code=000). On a --lazy first start it is worse: restart()'s finally crashes on slot_cv, which exists only after a successful READY, so an AttributeError masked the failure as a 400 "the request is malformed".

Changes

  • __init__ raises EngineDied instead of bare RuntimeError for the start failure. EngineDied is a RuntimeError, so restart()'s retry loop and every existing except RuntimeError still catch it — but the request path's except EngineDied now answers 503 "the engine did not report READY within N s …; the next request restarts it", the same shape as the mid-request silence path that already works. Covers /v1/chat/completions, /v1/messages, /v1/responses and /v1/load.
  • restart()'s finally skips the slot_cv wakeup when a lazy first start never created it — no waiters exist before the first READY anyway.

Test plan

New serve/test_ready_timeout.py (runs with python -m unittest serve.test_ready_timeout, no GPU/model):

  • test_ready_timeout_on_lazy_load_answers_the_request — silent fake engine, lazy load → 503 with the reason. Unfixed code: 400 malformed-request.
  • test_ready_timeout_on_restart_answers_the_request — engine answers one request, is killed, then its restart never reports READY → 503. Unfixed code: the connection closed with no answer (RemoteDisconnected), the reported symptom.

serve.test_server + serve.test_fatal_recovery + serve.test_restart_waiters + serve.test_lifecycle: 299 tests pass (3 unrelated errors — regex module not installed here, pre-existing).

Not tested: the real engine binary; the fake engines speak the READY/GEN/DONE protocol the tests already rely on.


🔄 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/1588 **Author:** [@nekomario28](https://github.com/nekomario28) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-1527-ready-timeout` --- ### 📝 Commits (1) - [`978f649`](https://github.com/Niko1221/Strata/commit/978f6499f1f7e05440169425355c05e7dc07c10e) serve: answer the request that hit the READY timeout (#1527) ### 📊 Changes **2 files changed** (+114 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+8 -4) ➕ `serve/test_ready_timeout.py` (+106 -0) </details> ### 📄 Description Fixes #1527. `STRATA_ENGINE_READY_S` (the #1317 read timeout) kills an engine that never says `READY`, but the request that was loading it ended with no response — the `RuntimeError` raised in `StrataEngine.__init__` matches none of the request path's handlers, so the connection closed unanswered (the reporter's `curl code=000`). On a `--lazy` first start it is worse: `restart()`'s `finally` crashes on `slot_cv`, which exists only after a successful READY, so an `AttributeError` masked the failure as a 400 "the request is malformed". ## Changes - `__init__` raises `EngineDied` instead of bare `RuntimeError` for the start failure. `EngineDied` is a `RuntimeError`, so `restart()`'s retry loop and every existing `except RuntimeError` still catch it — but the request path's `except EngineDied` now answers **503 "the engine did not report READY within N s …; the next request restarts it"**, the same shape as the mid-request silence path that already works. Covers `/v1/chat/completions`, `/v1/messages`, `/v1/responses` and `/v1/load`. - `restart()`'s `finally` skips the `slot_cv` wakeup when a lazy first start never created it — no waiters exist before the first READY anyway. ## Test plan New `serve/test_ready_timeout.py` (runs with `python -m unittest serve.test_ready_timeout`, no GPU/model): - `test_ready_timeout_on_lazy_load_answers_the_request` — silent fake engine, lazy load → **503 with the reason**. Unfixed code: 400 malformed-request. - `test_ready_timeout_on_restart_answers_the_request` — engine answers one request, is killed, then its restart never reports READY → **503**. Unfixed code: the connection closed with no answer (`RemoteDisconnected`), the reported symptom. `serve.test_server` + `serve.test_fatal_recovery` + `serve.test_restart_waiters` + `serve.test_lifecycle`: 299 tests pass (3 unrelated errors — `regex` module not installed here, pre-existing). Not tested: the real engine binary; the fake engines speak the READY/GEN/DONE protocol the tests already rely on. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:42:14 +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#3546
No description provided.