mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5270] [Benchmark] Windows: a real timeout can be classified connection_TimeoutError (timer thread races the socket timeout) #3138
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#3138
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 @yeyeyeason on GitHub (Nov 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5270
Area
[Benchmark] (measurements and reports)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
tests/terminal/test_bench_standard.py::RunTests::test_a_request_that_never_finishes_times_outintermittently fails on Windows with:It failed once and passed once in two consecutive full-file runs — intermittent, consistent with a race.
stream_chat(strata_cli/bench_standard.py:181-303) enforces its timeout with two mechanisms racing each other: the socket's own timeout (anHTTPConnection(timeout_s)raisingTimeoutErrorfromreadline()) and athreading.Timer(bench_standard.py:193-207) whoseexpire()setsraw["timed_out"] = Trueand then closes the socket. The handler atbench_standard.py:289-293classifies by the flag first, so when the socket timeout raises a few milliseconds before the timer thread runs its assignment, a genuine timeout is labeledconnection_TimeoutError.A stdlib-only minimal reproduction of the pattern (one hanging server, the same timer-plus-flag-and-close, 0.6 s on both paths) misclassified 1 run in 5:
Windows timer-thread scheduling makes this window easy to hit; on Linux it is narrower.
A one-line fix covers it: in the
excepthandler, treat aTimeoutError/socket.timeoutitself as a timeout in addition to the flag, e.g.Happy to prepare the PR if agreed.
Smallest steps or command that reproduce it
From a v0.2.10 checkout on Windows:
Intermittent: failed once, passed once in two consecutive runs. The minimal reproduction reproduces the misclassification itself 1-in-5.
Reproduction status
Reproduced locally
Strata version
v0.2.10 checkout, commit
ffa80d73Graphics card, memory and system
RTX 4060 Ti 16 GB x2 · 96 GB RAM · Windows 11 Pro (no GPU is used by these tests)
Model, size and settings
Not applicable — mock-server test path.
Logs
The two failing assertions and the minimal reproduction output are quoted above; the repro script is ~40 lines of stdlib only and can be attached if useful.