[PR #3235] [CLOSED] [Benchmark] strata_bench: both Windows start-up paths crash (NameError port, GBK decode of CMakeLists) #4516

Closed
opened 2026-11-07 15:36:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 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)

  • 7019627 tools: strata_bench died with NameError: name port when it had to start the server itself
  • 98b0d0a tools: 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.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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3235 **Author:** [@Yunado](https://github.com/Yunado) **Created:** 10/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/bench-start-port` --- ### 📝 Commits (2) - [`7019627`](https://github.com/Niko1221/Strata/commit/7019627e7efdc5a7f6eba2bad91ba1fdfe0f0bdb) tools: strata_bench died with NameError: name port when it had to start the server itself - [`98b0d0a`](https://github.com/Niko1221/Strata/commit/98b0d0a3e9338948b4d3f7ca22b4481bd1808ea6) tools: strata_bench also died reading CMakeLists.txt under a GBK locale ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tools/strata_bench.py` (+5 -3) </details> ### 📄 Description **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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:36:36 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4516
No description provided.