Issues / #2872

#2872 bench.sh crashes with NameError when it starts the server itself (regression from #2330)

open · @kristoffern · 0 comments · View on GitHub

BenchmarksSetup & installNVIDIA / CUDALinux

Description

### What happened

`./bench.sh` (with no `--url`) crashes 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
```

Commit 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)))`, but `port` is still used at lines 987, 990 and 991 (`start_server(cfg_path, port, ...)`). Every run where bench.sh starts the server hits this. Running with `--url` against an already running server works, because it skips that branch.

To reproduce: a set-up install with no server running, then `./bench.sh`.

Suggested fix: keep the variable.

```python
port = a.port or int(cfg.get("port", 8080))
base = server_base(cfg.get("host"), port)
```

Workaround until then: start the model with `./run-<model>.sh`, then `./bench.sh --url http://127.0.0.1:<port>`.

### Strata version, GPU, OS

Engine 0.1.45 (main at 477ac13c, still present on main today). RTX 3090, Linux (Ubuntu 24.04 base), engine compiled from source by setup.

Related on this site

Quick links to related pages.