mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2432] Server deadlocks when the console window is paused (QuickEdit selection): the finish path prints the done line while holding status_lock #987
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#987
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @anwang888 on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2432
Summary
On Windows, selecting text in the server's console window (QuickEdit) pauses the console — and that permanently deadlocks the server: the per-request finish path prints the
[strata] done:line while holdingstatus_lock, so the print blocks forever holding the lock, and every later request hangs onstatus_lock(in_progress/_note). The engine itself stays alive and healthy. Reproduced 3 times in real use on 0.1.43.1 (both IQ3_S and Unsloth UD-IQ4_XS); the same structure exists in 0.1.42 and 0.1.43.Root cause
serve/server.py, the request-finishfinallyblock (line numbers for 0.1.43.1; the same shape in 0.1.43 at 4029–4084 and 0.1.42 at 3935–3990):When the console is paused (QuickEdit selection),
print()blocks inWriteConsolewhile the lock is held. Three moreprint()calls sit inside this samewithblock (repeated-reasoning, max-tokens-while-thinking, etc.)._progress()takes the same lock (with self.status_lock:at :3798), so the next request's first progress line parks there forever./v1/statusshows the requestin_flight; the engine log's last line is the engine-side stats — the[strata] done:line is missing, which is the blocked print itself.Reproduction (100%)
run-<model>.bat(a console window)._progress (serve/server.py:3798)(with self.status_lock:), double-sampled 12 s apart, identical; no thread in the process is insidestatus_lockat that point (the holder is the finish thread, blocked in the console write).done:lines print normally. A console-window run hangs again on the next selection.Pressing Esc/Enter in the window should release the console and let the print finish (not tested here; we always restarted, which also recovers).
Suggested fix
Compute the
donemessage inside the lock if needed, but move everyprint()in the finish path outside thewith self.status_lock:block. The same applies to the other lock-held prints found in the finish/unload/error paths (_progressitself already prints outside its lock, which is the right pattern).A wrapper that disables
ENABLE_QUICK_EDIT_MODEat startup also mitigates it for anyone running the stock.batfiles, but redirecting-vs-console is user-visible only after the fact — moving the prints out of the lock is the real fix.Environment
/v1/messagesand/v1/chat/completions)Happy to attach py-spy dumps or the exact log excerpts if useful.
@qiuzan2001 commented on GitHub (Oct 15, 2026):
Confirmed in main
296b59d2(Linux): the[strata] doneprint at serve/server.py:4490 (and 4493, 4497) runs insidewith self.status_lock(line 4435), so a console that stops reading (QuickEdit on Windows, a full stdout pipe elsewhere) blocks every thread that next takes that lock. Open PR #2481's AST check (serve/test_lock_io.py) lists 9 such sites on main (server.py:1601, 1604, 4490, 4493, 4497; mcp.py:396, 445, 446; structured.py:48) and passes on that branch.@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.