strata_bench.py: NameError: name 'port' is not defined when it starts the server itself (0.1.45, since #2330)
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 96/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- developer-experience
Research direction
Start with the server-start branch around lines 987-991 in tools/strata_bench.py, then reproduce with tools\strata_bench.py --config strata-iq3_s.json --long while no server is running. Confirm the config-defined or argument-supplied port is available before constructing the base URL and starting the server; the command should pass the startup path instead of raising NameError.
Written by the indexing model from the issue text.
Description
What happens
With no Strata server running, tools\strata_bench.py --config strata-iq3_s.json --long stops at once:
File "C:\Tools\Strata\tools\strata_bench.py", line 990, in main
say(f"Starting {cfg_path.name} on port {port} (loading takes 1-3 minutes; the PC may be slow meanwhile) ...")
NameError: name 'port' is not defined
Cause
69fe4055 (#2330, PR #2362) replaced
port = a.port or int(cfg.get("port", 8080))
base = f"http://127.0.0.1:{port}"
with base = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080))), so port is no longer bound, but lines 987, 990 and 991 (start_server(cfg_path, port, ...)) still use it. Only the path where the bench starts the server is affected; against a running server (or with --url) it works.
Fix (suggestion)
port = a.port or int(cfg.get("port", 8080))
base = server_base(cfg.get("host"), port)
(port is only needed in the branch with a config, which is the only branch that reaches line 987.)
Setup: Windows 11, 0.1.45 release zip (strata-windows-x64.zip), repo at 477ac13c. Worked around by starting the server first; the bench then uses the running server.
- Dominant language
- C++
- Stars
- 11.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Niko1221/Strata
-
[Bug]: ple_reader_selftest can crash or hang when two runs share the temp directoryPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
CachyOS/New-Cli-Installer#50 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
Qiskit/qiskit-aer#2482 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nasa/fprime#6225 · 1 comment ·
Maintainers usually reply within 1 day
-
content good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
cpinitiative/usaco-guide#6699 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
codepointerapp/codepointer#231 ·