mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3235] [CLOSED] [Benchmark] strata_bench: both Windows start-up paths crash (NameError port, GBK decode of CMakeLists) #4516
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#4516
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/3235
Author: @Yunado
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:fix/bench-start-port📝 Commits (2)
7019627tools: strata_bench died with NameError: name port when it had to start the server itself98b0d0atools: strata_bench also died reading CMakeLists.txt under a GBK locale📊 Changes
1 file changed (+5 additions, -3 deletions)
View changed files
📝
tools/strata_bench.py(+5 -3)📄 Description
The problem and the result.
strata_bench.pycannot run at all on Windows: both start-up paths die before the suite begins.NameError: name 'port' is not defined: the port is computed inline forserver_base(a.port or cfg["port"] or 8080) but the three users below name a plainportthat was never assigned, so the run dies at the first "Port ... is used by something that is not Strata" / "Starting ... on port ..." line. Reproduced on this PC as SETUP's BENCH step (engine 0.1.45).UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf:project_version()readsCMakeLists.txt(UTF-8 with a byte-order mark) with the locale default, GBK on this Chinese Windows, before the machine line is even printed; the surroundingexcept OSErrorsoft fallback never sees it because a decode error is aValueError. Reproduced on this PC (manual run against the serving line).With both fixes the bench reaches the suite as documented.
The approach. Two small changes in
tools/strata_bench.py, each on its crash path: assignport = a.port or int(cfg.get("port", 8080))once wherebaseis computed (the same no-url branch the three users live in; same precedence: --port beats the config's port beats 8080), and read the CMakeLists asutf-8-sigwith the soft fallback widened toValueErrorso one odd file cannot kill a run. Every other text read in the tool already names an encoding (audited); the--urlpath is untouched.Validation.
py_compile;strata_bench.py --help; static walk of the threeportuses (all in the branch where it is now assigned);project_version()andgit_commit()called directly on this Chinese Windows return0.1.45.3and the short commit (both crashed before).Limits. The port bug is not Windows-specific (every auto-start run anywhere hits it); the decode bug bites machines whose locale codec cannot read the byte-order mark.
Environment:
e88ee39d(v0.2.0-beta-12), Chinese Windows 11 Pro (GBK locale), Python 3.12.0, RTX 5090.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.