mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4759] [Engine] serve: a stalled peer does not hold a handler or the engine's turn #5168
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#5168
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4759
Author: @Tsury
Created: 10/30/2026
Status: 🔄 Open
Base:
main← Head:fix-peer-stall📝 Commits (1)
eafc557[Engine] serve: a stalled peer does not hold a handler or the engine's turn📊 Changes
2 files changed (+141 additions, -2 deletions)
View changed files
📝
serve/server.py(+9 -2)➕
serve/test_connection_deadline.py(+132 -0)📄 Description
Problem and result
Two peers hold server resources for good. One connects and sends nothing, which holds a handler thread. The other asks for a stream and stops reading: the write blocks while the generator is suspended inside the turn, so every other request waits behind it.
After this change, each socket operation has a deadline:
STRATA_PEER_STALL_S, 120 s by default, and0keeps the old unbounded wait. This bounds one stalled operation, not a request. A peer that keeps sending or reading never reaches it.Related discussion
Based on #2916 by @ctr-137, closed in the 0.2.0-beta tracker reset and not reopened. The test file comes from that PR, rebased on current
main. If they would rather reopen theirs, I will close this one.Approach
timeout = PEER_STALL_Son the handler class.BaseHTTPRequestHandlerapplies it to the connection.Validation
Passed:
main(870aedd9): 4 errors. With the change: all pass.python -m unittest serve.test_connection_deadline serve.test_server serve.test_structured: 372 tests pass (Linux, Python 3.14).Not run:
python -m unittest discover -s serveand any GPU or model run. This change was split from a maintained v0.2.8 build that runs on an RTX 5090 Laptop; the unit tests above are the evidence for this branch.Limits
This changes a default. A client that stops reading for more than 120 s while staying connected loses the stream; set
STRATA_PEER_STALL_S=0to keep the old behaviour.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.