mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 21:05:40 +07:00
[GH-ISSUE #3188] [Benchmark] BENCH.bat / strata_bench.py crashes with NameError when it starts the server #1286
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#1286
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 @IVoyt on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3188
Area
[Benchmark] (measurements and reports)
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
tools/strata_bench.pycrashes with aNameErroras soon as it has to start the server itself — which is the default path and the oneBENCH.batuses:The name
portis never assigned inmain(); onlya.portand the localbaseexist. Three lines use the undefined name:tools/strata_bench.py:987—print(f"Port {port} is used by something that is not Strata: pass --port N.", ...)tools/strata_bench.py:990—say(f"Starting {cfg_path.name} on port {port} ...")tools/strata_bench.py:991—proc = start_server(cfg_path, port, a.gpu, log_path)Line 990 is reached on every run that starts a server, so the tool fails immediately, before the model is loaded and before any measurement.
Smallest steps or command that reproduce it
(or
BENCH.bat, which calls the same tool with the same arguments).--url http://127.0.0.1:<port>works, because that path never reaches the broken lines.Reproduction status
Reproduced locally.
Strata version
Strata 0.2.0-beta (build 0.1.45.3), git
3fa1b524(v0.2.0-beta-7), source checkout.Graphics card, memory and system
RTX 5090 32 GB - 96 GB RAM - Windows 11 (10.0.26300), i7-12700KF, driver 617.42, CUDA toolkit 13.1 (nvcc 13.1.115), Python 3.13.12.
Model, size and settings
Swift 1.5 Qwen3.8-Flash-Next IQ3_S, 524288 context, pictures off.
Expected behavior
The tool starts the server on the config's port (or
--port), waits for the model, runs the suite and writes the results folder.Actual behavior
NameError: name 'port' is not definedattools/strata_bench.py:990, immediately.Suggested fix
Bind the port once and use it in the three places:
and use
portat lines 987, 990 and 991.Additional context
main()test intools/test_strata_bench.pycalls the tool with--url(line 216:argv = ["--url", srv.base, "--out", out_dir, "--runs", "2", "--quiet", *extra]), so the "start the server" branch is never executed by the suite. A test that starts the server on a free port would have caught this.engine-log-excerpt.txt); with--urlthat file is not produced, so the workaround loses the log excerpt as well.python tools\test_strata_bench.pyfails on a PC whose account name isuser, because the redaction placeholder is<user>and the test asserts the account name is absent from the redacted text (tools/test_strata_bench.py:186-187,len(user) >= 4). The test needs a name that is not a substring of the placeholder, or the placeholder needs to differ.@github-actions[bot] commented on GitHub (Oct 19, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 19, 2026):
Thanks, this follows the format now.
@ZrDaniel07 commented on GitHub (Oct 19, 2026):
Confirmed on Windows 11 + RTX 5090 (CUDA, engine 0.1.45, repo v0.2.0-beta; the exact same lines are in today's
main, fetched 2026-10-19).Repro: setup finishes with the model installed and the server not started; answering
yto "Run a quick benchmark now?" enters the start-its-own-server branch and crashes immediately:Root cause: the port is only computed inline into
base(line 976:base = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080)))) and is never bound to aportvariable; the server-start branch then referencesportthree times (lines 987, 990, 991). Any run that needs the bench to start its own server hits this before measuring anything.Fix applied locally (syntax-checked with
py_compile, script loads fine):Workaround until fixed: keep the Strata server already running when
BENCH.batis launched — line 980 (is_strata(base, key)) detects it and benchmarks the running server, so the buggy branch never executes.@JoShMiQueL commented on GitHub (Oct 19, 2026):
Reproduced on
maine88ee39d(0.2.0-beta, 2026-10-19), Windows 11 build 26200, RTX 4060 Ti 16 GB, driver 616.92 — pointed at a port where nothing listens, so the command stops before starting anything:Two details that may help whoever picks it up:
ruff check tools/strata_bench.pyreportsF821 Undefined name 'port'on all three lines (:1037,:1040,:1041), so a lint run would have caught it before the release.69fe4055(#2330): it replacedport = a.port or int(cfg.get("port", 8080))+base = f"http://127.0.0.1:{port}"withbase = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080)))and left the three uses ofportbehind. The same lines are in thev0.2.0-betatag, so anything running the tool from that tag is affected.Why the test suites stay green on this revision:
tools/test_strata_bench.py(17 tests one88ee39d, 20 with the branch of #3250) only exercises the--urlpath against a fake server, never the branch that starts the server. So until this is fixed, a re-measure on 0.2.0-beta needs either this fix or--urlagainst a server started by hand. Restore the dropped assignment and add one test that reaches the start-server branch with a stubstart_server, and it should be covered.I have not opened a pull request for it — happy to prepare the one-line fix plus that test if it is wanted.
@GoldenLeafBird commented on GitHub (Oct 20, 2026):
Hit this at v0.1.45 first and again at v0.2.1 (blob
3a9877f, still present onmain at
9ae93f7). Minimal local fix, three tokens in the server-start branch ofmain(),port->a.port:(Lines 989/992/993 at v0.2.1. The
sayline is abbreviated above; the edit isonly the
porttoken.)Unrelated note from the same file: the module-level
import shutilis unusedin the whole file at v0.2.1, so it can go with the same change.
Environment: Windows 10 build 19044, source checkout, RX 7900 XTX. Reproduced
2026-10-19 on 0.1.45 and confirmed present 2026-10-20 at v0.2.1.