Pull requests / #3235
#3235 [Benchmark] strata_bench: both Windows start-up paths crash (NameError port, GBK decode of CMakeLists)
open · @Yunado · 0 comentários · No GitHub
BenchmarksSetup & installNVIDIA / CUDAWindows
Descrição
**The problem and the result.** ``strata_bench.py`` cannot run at all on Windows: **both** start-up paths die before the suite begins.
1. **Self-start path** (no server running, the bench starts one: the first bench of a fresh install). ``NameError: name 'port' is not defined``: the port is computed inline for ``server_base`` (``a.port or cfg["port"] or 8080``) but the three users below name a plain ``port`` that 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).
2. **Connect-to-running path** (a server is already serving). ``UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf``: ``project_version()`` reads ``CMakeLists.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 surrounding ``except OSError`` soft fallback never sees it because a decode error is a ``ValueError``. 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: assign ``port = a.port or int(cfg.get("port", 8080))`` once where ``base`` is 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 as ``utf-8-sig`` with the soft fallback widened to ``ValueError`` so one odd file cannot kill a run. Every other text read in the tool already names an encoding (audited); the ``--url`` path is untouched.
**Validation.**
- passed: ``py_compile``; ``strata_bench.py --help``; static walk of the three ``port`` uses (all in the branch where it is now assigned); ``project_version()`` and ``git_commit()`` called directly on this Chinese Windows return ``0.1.45.3`` and the short commit (both crashed before).
- failed: none.
- not run: a full bench suite (the GPU was serving this PC all day; both crash lines are the reproduced ones).
**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.
No site
Links install, modelos, releases.