[GH-ISSUE #1012] 0.1.39 serve: after an engine restart, waiting requests hang forever or fail with "list.remove(x): x not in list" #442

Closed
opened 2026-11-04 01:43:05 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Jackwwg83 on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1012

Summary: after the server restarts a failed engine, requests that were already waiting for the control lines never finish. Others fail with list.remove(x): x not in list. In our run, 5 requests stayed at "reading the prompt" for over 90 minutes. /health said loaded: true, and the GPU was idle.

Version: Strata v0.1.39 (6f32ec0), Linux, RTX PRO 5000 Blackwell 48 GB, IQ3_S, "parallel": 8.

What triggers it: any engine exit while requests wait. In our case the trigger was the batch-window OOM from #997 (verify: batch instantiate: out of memory) with 10 concurrent users.

Server log

[strata] the engine reported an error: verify: batch instantiate: out of memory
[strata] the engine had stopped (exit code 1); starting it again (a minute or two) ...
[strata] starting the engine: reading the model's weights ...
[strata] reading the prompt: 34,465 tokens, 10 s so far
...
[strata] the engine is running again
[strata] the engine reported an error: list.remove(x): x not in list
[strata] done: 0 tokens in 14 s (0.0 tok/s) (error, cancel=False)
...
[strata] the engine reported an error: list.remove(x): x not in list
...
[strata] reading the prompt: 30,568 tokens, 5531 s so far
[strata] reading the prompt: 29,188 tokens, 5521 s so far
[strata] reading the prompt: 34,712 tokens, 5531 s so far
[strata] reading the prompt: 45,184 tokens, 5531 s so far
[strata] reading the prompt: 28,099 tokens, 5521 s so far

The last five lines repeat every 10 s until the clients disconnect.

Cause (from reading serve/server.py at v0.1.39)

  • StrataEngine.restart() (line 577) restarts the engine by calling self.__init__(*self.spawn) (line 590) on the live object.
  • __init__ creates the admission state again (lines 507-512): slot_cv, waiting, wait_lens, ctl_epoch and the ctl lock.
  • A request thread that is already in _take_control() (line 815) still waits on the old ctl lock and the old slot_cv. Nothing notifies or releases them again, so these requests hang (the 10 s heartbeats above).
  • A thread that leaves _take_control() runs self.wait_lens.remove(entry) (line 840) on the new, empty list. This raises ValueError: list.remove(x): x not in list, and the request fails. self.waiting also ends up below zero.

Possible fix: keep the admission state (locks, condition, wait list and counters) outside the part of __init__ that restart() runs again. Or, in restart(), end every waiting request with an error before the engine starts again, so that clients can retry.

Originally created by @Jackwwg83 on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1012 **Summary:** after the server restarts a failed engine, requests that were already waiting for the control lines never finish. Others fail with `list.remove(x): x not in list`. In our run, 5 requests stayed at "reading the prompt" for over 90 minutes. `/health` said `loaded: true`, and the GPU was idle. **Version:** Strata v0.1.39 (`6f32ec0`), Linux, RTX PRO 5000 Blackwell 48 GB, IQ3_S, `"parallel": 8`. **What triggers it:** any engine exit while requests wait. In our case the trigger was the batch-window OOM from #997 (`verify: batch instantiate: out of memory`) with 10 concurrent users. **Server log** ``` [strata] the engine reported an error: verify: batch instantiate: out of memory [strata] the engine had stopped (exit code 1); starting it again (a minute or two) ... [strata] starting the engine: reading the model's weights ... [strata] reading the prompt: 34,465 tokens, 10 s so far ... [strata] the engine is running again [strata] the engine reported an error: list.remove(x): x not in list [strata] done: 0 tokens in 14 s (0.0 tok/s) (error, cancel=False) ... [strata] the engine reported an error: list.remove(x): x not in list ... [strata] reading the prompt: 30,568 tokens, 5531 s so far [strata] reading the prompt: 29,188 tokens, 5521 s so far [strata] reading the prompt: 34,712 tokens, 5531 s so far [strata] reading the prompt: 45,184 tokens, 5531 s so far [strata] reading the prompt: 28,099 tokens, 5521 s so far ``` The last five lines repeat every 10 s until the clients disconnect. **Cause (from reading `serve/server.py` at v0.1.39)** - `StrataEngine.restart()` (line 577) restarts the engine by calling `self.__init__(*self.spawn)` (line 590) on the live object. - `__init__` creates the admission state again (lines 507-512): `slot_cv`, `waiting`, `wait_lens`, `ctl_epoch` and the `ctl` lock. - A request thread that is already in `_take_control()` (line 815) still waits on the old `ctl` lock and the old `slot_cv`. Nothing notifies or releases them again, so these requests hang (the 10 s heartbeats above). - A thread that leaves `_take_control()` runs `self.wait_lens.remove(entry)` (line 840) on the new, empty list. This raises `ValueError: list.remove(x): x not in list`, and the request fails. `self.waiting` also ends up below zero. **Possible fix:** keep the admission state (locks, condition, wait list and counters) outside the part of `__init__` that `restart()` runs again. Or, in `restart()`, end every waiting request with an error before the engine starts again, so that clients can retry.
Author
Owner

@Niko1221 commented on GitHub (Oct 6, 2026):

Fixed in 0.1.40.1, thank you for the report and the cause. restart() no longer builds a new lock, condition variable and wait list: they are kept, so the waiting requests still own what they wait on, and the restart wakes them. A waiting request now goes on with the new engine, or ends at once with a 503 saying it was not sent, so the client can retry. There is no list.remove error and no hang. While testing we found a second wait: a long prompt being read when the engine died ended only after 300 s; it ends at once now. To update once: in your Strata folder run git fetch origin then git reset --hard origin/main (the repository history was cleaned up today, so UPDATE.bat's normal pull refuses it this one time; after that UPDATE.bat works as before). The engine is the same as 0.1.40.

<!-- gh-comment-id:6013766860 --> @Niko1221 commented on GitHub (Oct 6, 2026): Fixed in 0.1.40.1, thank you for the report and the cause. restart() no longer builds a new lock, condition variable and wait list: they are kept, so the waiting requests still own what they wait on, and the restart wakes them. A waiting request now goes on with the new engine, or ends at once with a 503 saying it was not sent, so the client can retry. There is no list.remove error and no hang. While testing we found a second wait: a long prompt being read when the engine died ended only after 300 s; it ends at once now. To update once: in your Strata folder run `git fetch origin` then `git reset --hard origin/main` (the repository history was cleaned up today, so UPDATE.bat's normal pull refuses it this one time; after that UPDATE.bat works as before). The engine is the same as 0.1.40.
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#442
No description provided.