Skip to content

fix(gateway): remove stale default pid file on startup - #14298

Closed
jackylai2660707 wants to merge 1 commit into
NousResearch:mainfrom
jackylai2660707:fix/stale-gateway-pid-cleanup
Closed

fix(gateway): remove stale default pid file on startup#14298
jackylai2660707 wants to merge 1 commit into
NousResearch:mainfrom
jackylai2660707:fix/stale-gateway-pid-cleanup

Conversation

@jackylai2660707

Copy link
Copy Markdown

Summary

  • remove stale default gateway.pid files directly when startup detects an invalid/dead PID
  • add a regression test covering the self-restart/systemd restart path where the default pid file points at a dead process

Problem

When a gateway self-restart or --replace handoff leaves behind a stale default gateway.pid, get_running_pid() correctly detects that the PID is dead but _cleanup_invalid_pid_path() routes cleanup through remove_pid_file(). That helper only removes pid files owned by the current process, so the stale pid file survives and subsequent startups keep failing with PID file race lost to another gateway instance.

Testing

  • /root/.hermes/hermes-agent/venv/bin/pytest tests/gateway/test_status.py -q

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #14153, #13709, #14002, #13934 — all fix the same stale gateway.pid cleanup issue. Note #14200 was already merged addressing this.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #14153. Note #14200 already merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants