[GH-ISSUE #2499] [Bug]: BENCH.bat / strata_bench.py crashes on Windows with a non-UTF-8 locale (UnicodeDecodeError reading CMakeLists.txt) #1015

Closed
opened 2026-11-04 01:47:45 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @hasifumi on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2499

What happened

BENCH.bat (tools/strata_bench.py) stops right after it finds the server on Windows with a Japanese locale (ANSI code page cp932). It never runs the suite:

Using the Strata server already running at http://127.0.0.1:8080.
Traceback (most recent call last):
  File "<strata>\tools\strata_bench.py", line 1028, in <module>
    sys.exit(main())
  File "<strata>\tools\strata_bench.py", line 989, in main
    pre = collect_machine(base, key, cfg, a.gpu)
  File "<strata>\tools\strata_bench.py", line 639, in collect_machine
    "strata_version": project_version(), "strata_commit": git_commit(),
  File "<strata>\tools\strata_bench.py", line 564, in project_version
    m = re.search(r"project\(strata VERSION ([\d.]+)", (ROOT / "CMakeLists.txt").read_text())
  File "...\Python311\Lib\pathlib.py", line 1059, in read_text
    return f.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 0: illegal multibyte sequence

Steps: a v0.1.44.1 checkout on Windows 11 (Japanese), then BENCH.bat (or .venv\Scripts\python.exe tools\strata_bench.py --url http://127.0.0.1:8080).

Cause: CMakeLists.txt starts with a UTF-8 BOM (ef bb bf). project_version() calls read_text() with no encoding, so Python uses the locale's code page (cp932 here). The except OSError around it does not catch UnicodeDecodeError (a ValueError), so the whole run stops instead of reporting no version. Other non-UTF-8 code pages (cp936, cp949, cp1252...) should hit the same error. Linux and English Windows usually read UTF-8, which is probably why it has not shown up.

Workaround: set PYTHONUTF8=1 before BENCH.bat. With it, the run finishes normally.

Possible fix: (ROOT / "CMakeLists.txt").read_text(encoding="utf-8-sig"), and/or except (OSError, ValueError) so that a version that cannot be read never stops the benchmark. I only checked this one call. The /proc reads in the same file are Linux-only, so they are not affected.

Strata version, GPU, OS

Strata v0.1.44.1 (engine 0.1.44.1, CUDA 13.0 ready-made), RTX 5060 Ti 16 GB, Windows 11 Pro 26200 (Japanese), Python 3.11

Engine log

Not relevant: the engine runs fine, and only the benchmark client fails.

Originally created by @hasifumi on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2499 ### What happened `BENCH.bat` (`tools/strata_bench.py`) stops right after it finds the server on Windows with a Japanese locale (ANSI code page cp932). It never runs the suite: ``` Using the Strata server already running at http://127.0.0.1:8080. Traceback (most recent call last): File "<strata>\tools\strata_bench.py", line 1028, in <module> sys.exit(main()) File "<strata>\tools\strata_bench.py", line 989, in main pre = collect_machine(base, key, cfg, a.gpu) File "<strata>\tools\strata_bench.py", line 639, in collect_machine "strata_version": project_version(), "strata_commit": git_commit(), File "<strata>\tools\strata_bench.py", line 564, in project_version m = re.search(r"project\(strata VERSION ([\d.]+)", (ROOT / "CMakeLists.txt").read_text()) File "...\Python311\Lib\pathlib.py", line 1059, in read_text return f.read() UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 0: illegal multibyte sequence ``` **Steps:** a v0.1.44.1 checkout on Windows 11 (Japanese), then `BENCH.bat` (or `.venv\Scripts\python.exe tools\strata_bench.py --url http://127.0.0.1:8080`). **Cause:** `CMakeLists.txt` starts with a UTF-8 BOM (`ef bb bf`). `project_version()` calls `read_text()` with no encoding, so Python uses the locale's code page (cp932 here). The `except OSError` around it does not catch `UnicodeDecodeError` (a `ValueError`), so the whole run stops instead of reporting no version. Other non-UTF-8 code pages (cp936, cp949, cp1252...) should hit the same error. Linux and English Windows usually read UTF-8, which is probably why it has not shown up. **Workaround:** `set PYTHONUTF8=1` before `BENCH.bat`. With it, the run finishes normally. **Possible fix:** `(ROOT / "CMakeLists.txt").read_text(encoding="utf-8-sig")`, and/or `except (OSError, ValueError)` so that a version that cannot be read never stops the benchmark. I only checked this one call. The `/proc` reads in the same file are Linux-only, so they are not affected. ### Strata version, GPU, OS Strata v0.1.44.1 (engine 0.1.44.1, CUDA 13.0 ready-made), RTX 5060 Ti 16 GB, Windows 11 Pro 26200 (Japanese), Python 3.11 ### Engine log Not relevant: the engine runs fine, and only the benchmark client fails.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271090276 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1015
No description provided.