mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4738] [Engine] avoid lost control-queue wakeups #5155
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#5155
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/4738
Author: @NektoDron
Created: 10/30/2026
Status: 🔄 Open
Base:
main← Head:fix-control-notify📝 Commits (1)
bd58e83serve: avoid lost control-queue wakeups📊 Changes
2 files changed (+267 additions, -1 deletions)
View changed files
📝
serve/server.py(+11 -1)➕
serve/test_control_notify.py(+256 -0)📄 Description
Problem and result
A control-queue waiter can read an ineligible fairness/order predicate, release
slot_cv, and miss a notification sent before it entersCondition.wait(). It then enters the 0.5-second timeout wait even though it can proceed. Removing a cancelled or closed waiter can also make another waiter eligible without notifying it.The regression tests reproduce these schedules deterministically against the actual unpatched
_take_controlmethod. The fix checks eligibility again under the condition lock before waiting and notifies when removal changes eligibility.Related discussion
None. This is a focused queue-notification fix; it does not change the service FIFO or admission policy.
Approach
Recheck both epoch/waiter fairness and
STRATA_ADMIT_SHORT_FIRSTarbitration. Removing an ordered request can select a new winner even when more than one waiter remains, so that removal also notifies the condition. Keep the existing lock-acquisition recheck, cancellation handling, queue deadlines and heartbeat behavior.Validation
Passed:
Linux, Python 3.14, base
870aedd9e1ebe1c91f94da93b59af17729f6c5c0plus this patch:python3 -m unittest serve.test_control_notify -v— 15 deterministic tests passed, without a GPU, process or wall-clock sleeps. They cover the check/wait gap, cancellation/close cleanup, three-waiter short-first handoff, a shorter arrival during acquire, restart/death and queue deadlines before/after acquisition.Negative control with the final tests and the exact upstream method: six intended race assertions fail; the other nine tests pass. The final fixed method passes all fifteen.
python3 -m unittest serve.test_control_notify serve.test_admit_order serve.test_queue_keepalive serve.test_parallel_yield serve.test_control_cancel serve.test_quiet_cancel serve.test_vision_busy serve.test_parallel -v— all 75 tests passed in 93.913 seconds on the same patched base (Python 3.14.4). These use mock engines/HTTP services, not a GPU model.python3 -m py_compile serve/server.py serve/test_control_notify.pyandgit diff --check— passed.Independent focused rerun on Python 3.12.14: all 15 notification tests passed.
Failed:
Not run:
Limits
These tests establish the notification schedules and preserve short-first/deadline behavior. They do not establish a model TTFT improvement or a general latency bound, and do not address unrelated FIFO/socket stalls.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.