Skip to content

qa-live unconditionally spawns a dashboard, even when one is already running #3

@dsaccon

Description

@dsaccon

What I observed

mega-tron qa-live (on 1b6aaba) always spawns a fresh mega-tron dashboard --port 7531 after at least one host PASSes. It does not check whether a dashboard is already running, or whether anything is bound to port 7531. On boxes where the user manages their own dashboard process (e.g. fronted by a reverse proxy on a non-loopback bind), every qa-live run leaves a redundant 127.0.0.1:7531 listener behind that has to be killed by hand.

Repro

  1. Launch a dashboard on a non-loopback bind: mega-tron dashboard --host 172.18.0.1 --port 7531 --no-open &
  2. Run mega-tron qa-live.
  3. After PASS, observe a second mega-tron process bound to 127.0.0.1:7531 (output line: [check] dashboard launched in background (PID … ) at http://127.0.0.1:7531/).
  4. ss -tlnp | grep 7531 shows two listeners.

Expected

qa-live skips the dashboard spawn if a mega-tron dashboard process is already running (or if port 7531 is already bound on any local interface).

Code

The spawn is unconditional at src/mega_tron/cli/qa_live.py:634:

pid = _launch_dashboard_detached()

_launch_dashboard_detached (line 451) does a straight subprocess.Popen([…, "dashboard", "--no-open", "--port", "7531"]) with no pre-checks.

Suggested fix

Before line 634, skip the spawn (and print a "using existing dashboard at …" message) when either:

  • any process named mega-tron dashboard is alive, or
  • port 7531 is already bound on 127.0.0.1, 0.0.0.0, or any interface mega-tron discovers.

Either check is a few lines

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions