[PR #2878] [CLOSED] [Benchmark] tools: give the bench's start branch back the port local it reads (#2872) #4311

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2878
Author: @ctr-137
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: bench-start-port-local


📝 Commits (1)

  • 738a482 tools: give the bench's start branch back the port local it reads (#2872)

📊 Changes

2 files changed (+61 additions, -2 deletions)

View changed files

📝 tools/strata_bench.py (+2 -1)
📝 tools/test_bench_host.py (+59 -1)

📄 Description

./bench.sh with no --url dies before it starts the model:

  File "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

69fe4055 (#2330) 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))), which removed the only
assignment of the local port - but the branch that starts its own server still reads it three times: the
"Port N is used by something that is not Strata" message, the "Starting ... on port N" message, and
start_server(cfg_path, port, ...). --url skips the branch, so it never tripped there.

This keeps the #2330 behaviour - the poll still goes to server_base(cfg host, port), so a 0.0.0.0 bind is
polled on loopback - and changes nothing else in the branch.

What I changed

  • tools/strata_bench.py: restore the local, keep server_base().
  • tools/test_bench_host.py: a StartsItsOwnServer class that drives main() into the branch with
    start_server and wait_ready stubbed out. The existing tests here only called server_base()
    directly, which is why the missing local got through.

It checks the port the server is given, the address polled (--port overriding the config, and loopback for
the config's 0.0.0.0), and the foreign-service-on-the-port case.

How I checked

On main today the new tests fail with the reported traceback at strata_bench.py:990; on this branch all 8
tests in tools/test_bench_host.py pass (python -m unittest tools.test_bench_host). No GPU is needed.

Fixes #2872. #2864 is the same report and should close with it.

🤖 Generated with Claude Code


🔄 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/2878 **Author:** [@ctr-137](https://github.com/ctr-137) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `bench-start-port-local` --- ### 📝 Commits (1) - [`738a482`](https://github.com/Niko1221/Strata/commit/738a482b452c548e29f7f48dbfb30e005b89e9a2) tools: give the bench's start branch back the `port` local it reads (#2872) ### 📊 Changes **2 files changed** (+61 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tools/strata_bench.py` (+2 -1) 📝 `tools/test_bench_host.py` (+59 -1) </details> ### 📄 Description `./bench.sh` with no `--url` dies before it starts the model: ``` File "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 ``` 69fe4055 (#2330) replaced ```python 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)))`, which removed the only assignment of the local `port` - but the branch that starts its own server still reads it three times: the "Port N is used by something that is not Strata" message, the "Starting ... on port N" message, and `start_server(cfg_path, port, ...)`. `--url` skips the branch, so it never tripped there. This keeps the #2330 behaviour - the poll still goes to `server_base(cfg host, port)`, so a `0.0.0.0` bind is polled on loopback - and changes nothing else in the branch. ### What I changed - `tools/strata_bench.py`: restore the local, keep `server_base()`. - `tools/test_bench_host.py`: a `StartsItsOwnServer` class that drives `main()` into the branch with `start_server` and `wait_ready` stubbed out. The existing tests here only called `server_base()` directly, which is why the missing local got through. It checks the port the server is given, the address polled (`--port` overriding the config, and loopback for the config's `0.0.0.0`), and the foreign-service-on-the-port case. ### How I checked On main today the new tests fail with the reported traceback at `strata_bench.py:990`; on this branch all 8 tests in `tools/test_bench_host.py` pass (`python -m unittest tools.test_bench_host`). No GPU is needed. Fixes #2872. #2864 is the same report and should close with it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:34:47 +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#4311
No description provided.