[GH-ISSUE #3766] [TUI] strata launch reports "this profile already has a live managed runtime" when the real cause is a port already in use #1582

Closed
opened 2026-11-04 01:52:24 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Daniel971 on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3766

Area: [TUI] (the Terminal: strata launch)

Desktop app, Terminal or source? Terminal (the strata command), installed with install.sh

What happened

Port 8080 on this PC is held by an unrelated application (a root-owned web app). strata launch on
port 8080 failed, and the message it printed named neither the port nor the real cause:

strata: The server could not start: this profile already has a live managed runtime
The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-32k.engine.log

Two things are wrong with that message:

  1. It is false. There was no live managed runtime. The owner host was still running, but its
    child server had already exited on the port error.
  2. It points at a log that does not contain the reason. The port error is in
    <profile>.server.log, not in the engine log. In the 64K reproduction below the engine log named
    in the message does not exist at all.

The correct text already exists in serve/server.py (listen_problem(), line 140) and is written to
the server log:

server.py: error: port 8080 is already in use - is Strata (or another server) already running? Close it, or start this one with a different --port

It never reaches the user.

Smallest steps to reproduce

Port 8080 must be taken by a program that is not Strata. On this PC:

ss -tlnp | grep ':8080'      # held by another app (root-owned); nothing from Strata is running

strata launch --model iq1_m --family coder --context 64k --vision cpu \
              --tune skip --access local --port 8080 --yes --no-tui

First run prints:

strata: The server did not become ready (failed: server_exited). The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log

The named engine log does not exist; the port error is in
~/.local/state/strata/runtime/launch-iq1_m-64k.server.log line 15.

Second run, same command, prints the misleading message:

strata: The server could not start: this profile already has a live managed runtime The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log

strata launch --status reports nothing running, and ps shows the owner host still alive:

daniel  126749  ... -m strata_control.runtime --host launch-iq1_m-64k --shutdown-timeout 30 --startup-wait 600

Using --port 8081 instead works (the server is serving on 8081 now).

Expected

The first run should say the port is taken and name the port, for example:

The server could not start: port 8080 is already in use by another program.
Close it, or start Strata on another port: strata launch --port 8081

and the second run should give the same message rather than "a live managed runtime".

Actual

Three separate defects, in the order the user meets them:

1. The owner host outlives its dead child (strata_control/runtime.py, Host.serve(), ~line 1242).
The loop clears self.running only on a signal or when die_with disappears. Nothing checks whether
self.child is still alive, so a host whose server exited on the port error keeps holding its lease.
It did on this machine: the host was still running after the failure, and strata launch --status
reported nothing running.

2. The zombie then poisons the next attempt (strata_control/runtime.py:297). _recover_stale()
cannot take the lease and raises:

raise ProfileError("this profile already has a live managed runtime", 6)

That is the false message. The profile has no live runtime; it has a host whose child died.

3. The real reason is discarded on the way out. _status() does collect the log tail
(strata_control/runtime.py:899):

return {**base, "ok": False, "state": "failed", "exit_code": child.returncode, "engine_exit_code": child.returncode,
        "error": self.last_error or "server_exited", "log_tail": self._log_tail()}

but runner.start() never reads log_tail (strata_cli/launch/runner.py:1059-1060):

if not r.get("ok"):
    raise LaunchError(f"The server did not become ready ({r.get('state')}: {r.get('error') or r.get('message') or 'see the engine log'}).",
                      _log_hint(self.config_path), 6)

So the user sees server_exited and a pointer to the engine log, and the port message stays in the
dict. _log_hint() (runner.py:1207) also always names the engine log, which is the wrong file
for a failure that happens before the engine is started.

Suggested fix

  1. Include log_tail in the message in runner.start() when it is present.
  2. Stop the host when its child is gone, after a short grace period so the status call that
    reports the reason still gets answered. A host whose child died should not keep the lease.
  3. Check the port before the expensive work. The check in serve/server.py:8088 runs only after
    the engine has been fetched and the model loaded (~90 s here). A bind probe in plan() and at the
    top of run() would turn that into a second, and would let strata launch --plan warn about it
    (it currently says nothing about the port).
  4. Name the right log in _log_hint() when the failure is server_exited rather than an engine
    crash; the server log is where this class of error lands.

Environment

Strata version:

  • Strata 0.2.2 (build 0.1.47), Terminal installed with install.sh
  • Engine 0.1.47 (cuda, cuda13), strata doctor reports terminal_cli ok, monitor_tui 8.2.8 ok

Graphics card, memory and system:

  • Ubuntu 26.04 LTS, x86-64, AVX2
  • NVIDIA RTX 3060 12 GB, driver 595.91.07
  • 30 GiB RAM, 382 GB free disk
  • Model: Qwen3.8-Flash-Next Coder IQ1_M, 32K context, pictures on (CPU reader)
  • Port 8080 held by an unrelated root-owned application; nothing from Strata was listening on it

Reproduction status

Reproduced locally, twice on the same PC, with the commands above. Both the first-run message
(server_exited plus a pointer to a non-existent engine log) and the second-run message
(this profile already has a live managed runtime) were observed as quoted. The line references come
from commit 011c9e60 (the 0.2.2 release commit).

Logs

~/.local/state/strata/runtime/launch-iq1_m-64k.server.log (the reason, lines 1-15):

usage: server.py [-h] [--engine {mock,strata}] [--config CONFIG] [--host HOST]
                 [--script-cycle] [--script-delay SCRIPT_DELAY]
                 [--script SCRIPT] [--port PORT] [--ready-file READY_FILE]
                 ...
server.py: error: port 8080 is already in use - is Strata (or another server) already running? Close it, or start this one with a different --port

No API keys are present in this log. The engine log named in the error message does not exist:

$ ls /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log
ls: cannot access '.../iq1_m-64k.engine.log': No such file or directory
  • #769 — the port 8080 is already in use message itself (closed; listen_problem() came from it).
    This report is about that message not reaching the user, not about its wording.
  • #3654 — a failed test start keeps only the tail of the engine log. Same theme of evidence being
    lost, different code path (the updater's test start).
  • #3710 — startup_wait_expired on a test start. Different symptom, same area.
Originally created by @Daniel971 on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3766 Area: [TUI] (the Terminal: strata launch) Desktop app, Terminal or source? Terminal (the `strata` command), installed with `install.sh` ## What happened Port 8080 on this PC is held by an unrelated application (a root-owned web app). `strata launch` on port 8080 failed, and the message it printed named neither the port nor the real cause: ``` strata: The server could not start: this profile already has a live managed runtime The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-32k.engine.log ``` Two things are wrong with that message: 1. **It is false.** There was no live managed runtime. The owner host was still running, but its child server had already exited on the port error. 2. **It points at a log that does not contain the reason.** The port error is in `<profile>.server.log`, not in the engine log. In the 64K reproduction below the engine log named in the message **does not exist at all**. The correct text already exists in `serve/server.py` (`listen_problem()`, line 140) and is written to the server log: ``` server.py: error: port 8080 is already in use - is Strata (or another server) already running? Close it, or start this one with a different --port ``` It never reaches the user. ## Smallest steps to reproduce Port 8080 must be taken by a program that is not Strata. On this PC: ```bash ss -tlnp | grep ':8080' # held by another app (root-owned); nothing from Strata is running strata launch --model iq1_m --family coder --context 64k --vision cpu \ --tune skip --access local --port 8080 --yes --no-tui ``` **First run** prints: ``` strata: The server did not become ready (failed: server_exited). The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log ``` The named engine log does not exist; the port error is in `~/.local/state/strata/runtime/launch-iq1_m-64k.server.log` line 15. **Second run, same command**, prints the misleading message: ``` strata: The server could not start: this profile already has a live managed runtime The engine's log has the reason: /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log ``` `strata launch --status` reports nothing running, and `ps` shows the owner host still alive: ``` daniel 126749 ... -m strata_control.runtime --host launch-iq1_m-64k --shutdown-timeout 30 --startup-wait 600 ``` Using `--port 8081` instead works (the server is serving on 8081 now). ## Expected The first run should say the port is taken and name the port, for example: ``` The server could not start: port 8080 is already in use by another program. Close it, or start Strata on another port: strata launch --port 8081 ``` and the second run should give the same message rather than "a live managed runtime". ## Actual Three separate defects, in the order the user meets them: **1. The owner host outlives its dead child** (`strata_control/runtime.py`, `Host.serve()`, ~line 1242). The loop clears `self.running` only on a signal or when `die_with` disappears. Nothing checks whether `self.child` is still alive, so a host whose server exited on the port error keeps holding its lease. It did on this machine: the host was still running after the failure, and `strata launch --status` reported nothing running. **2. The zombie then poisons the next attempt** (`strata_control/runtime.py:297`). `_recover_stale()` cannot take the lease and raises: ```python raise ProfileError("this profile already has a live managed runtime", 6) ``` That is the false message. The profile has no live runtime; it has a host whose child died. **3. The real reason is discarded on the way out.** `_status()` does collect the log tail (`strata_control/runtime.py:899`): ```python return {**base, "ok": False, "state": "failed", "exit_code": child.returncode, "engine_exit_code": child.returncode, "error": self.last_error or "server_exited", "log_tail": self._log_tail()} ``` but `runner.start()` never reads `log_tail` (`strata_cli/launch/runner.py:1059-1060`): ```python if not r.get("ok"): raise LaunchError(f"The server did not become ready ({r.get('state')}: {r.get('error') or r.get('message') or 'see the engine log'}).", _log_hint(self.config_path), 6) ``` So the user sees `server_exited` and a pointer to the engine log, and the port message stays in the dict. `_log_hint()` (`runner.py:1207`) also always names the **engine** log, which is the wrong file for a failure that happens before the engine is started. ## Suggested fix 1. **Include `log_tail` in the message** in `runner.start()` when it is present. 2. **Stop the host when its child is gone**, after a short grace period so the status call that reports the reason still gets answered. A host whose child died should not keep the lease. 3. **Check the port before the expensive work.** The check in `serve/server.py:8088` runs only after the engine has been fetched and the model loaded (~90 s here). A bind probe in `plan()` and at the top of `run()` would turn that into a second, and would let `strata launch --plan` warn about it (it currently says nothing about the port). 4. **Name the right log** in `_log_hint()` when the failure is `server_exited` rather than an engine crash; the server log is where this class of error lands. ## Environment Strata version: - Strata 0.2.2 (build 0.1.47), Terminal installed with `install.sh` - Engine 0.1.47 (cuda, cuda13), `strata doctor` reports `terminal_cli ok`, `monitor_tui 8.2.8 ok` Graphics card, memory and system: - Ubuntu 26.04 LTS, x86-64, AVX2 - NVIDIA RTX 3060 12 GB, driver 595.91.07 - 30 GiB RAM, 382 GB free disk - Model: Qwen3.8-Flash-Next Coder IQ1_M, 32K context, pictures on (CPU reader) - Port 8080 held by an unrelated root-owned application; nothing from Strata was listening on it ## Reproduction status **Reproduced locally**, twice on the same PC, with the commands above. Both the first-run message (`server_exited` plus a pointer to a non-existent engine log) and the second-run message (`this profile already has a live managed runtime`) were observed as quoted. The line references come from commit `011c9e60` (the 0.2.2 release commit). ## Logs `~/.local/state/strata/runtime/launch-iq1_m-64k.server.log` (the reason, lines 1-15): ``` usage: server.py [-h] [--engine {mock,strata}] [--config CONFIG] [--host HOST] [--script-cycle] [--script-delay SCRIPT_DELAY] [--script SCRIPT] [--port PORT] [--ready-file READY_FILE] ... server.py: error: port 8080 is already in use - is Strata (or another server) already running? Close it, or start this one with a different --port ``` No API keys are present in this log. The engine log named in the error message does not exist: ``` $ ls /home/daniel/.local/state/strata/launch/iq1_m-64k.engine.log ls: cannot access '.../iq1_m-64k.engine.log': No such file or directory ``` ## Related - #769 — the `port 8080 is already in use` message itself (closed; `listen_problem()` came from it). This report is about that message not reaching the user, not about its wording. - #3654 — a failed test start keeps only the tail of the engine log. Same theme of evidence being lost, different code path (the updater's test start). - #3710 — `startup_wait_expired` on a test start. Different symptom, same area.
bsakaguchi 2026-11-04 01:52:24 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 22, 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:

  • Fill in "Area".
  • Fill in "Desktop app, Terminal or source?".
  • Fill in "Strata version".
  • Fill in "Graphics card, memory and system".

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

<!-- gh-comment-id:6350473066 --> @github-actions[bot] commented on GitHub (Oct 22, 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: - [ ] Fill in "Area". - [ ] Fill in "Desktop app, Terminal or source?". - [ ] Fill in "Strata version". - [ ] Fill in "Graphics card, memory and system". 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](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

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

This is fixed in Strata 0.2.3. Please update to the latest release (in the Terminal: strata update; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.

<!-- gh-comment-id:6383450096 --> @Niko1221 commented on GitHub (Oct 24, 2026): This is fixed in Strata 0.2.3. Please update to the latest release (in the Terminal: `strata update`; in the app: download the newest installer from the releases page). If it still happens on the latest version, reply here and we will reopen it. Thank you for the report.
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#1582
No description provided.