Skip to content

fix(BA-8114): detect an orphan agent by its rpc port when the pid-file is missing - #14958

Merged
fregataa merged 3 commits into
mainfrom
fix/BA-8114-dev-agent-pid-fallback
Oct 22, 2026
Merged

fregataa merged 3 commits into
mainfrom
fix/BA-8114-dev-agent-pid-fallback

Conversation

@agatha197

Copy link
Copy Markdown
Contributor

Summary

  • ./dev identified agent/sftp-agent solely by their pid-files (both share the backend.ai: agent proctitle), so a missing agent.pid made restart skip the stop: the orphan agent kept its ports and the freshly started agent died on bind (OSError: [Errno 98] Address already in use), its tmux window closing traceless while status reported "stopped".
  • Add _get_agent_pid: resolve the pid-file first, then fall back to the listener of the rpc-listen-addr port from the service's toml (ss -tlnpH), walking up from the worker listener to the main process. _is_running, _stop_service, and status now use it, so orphans are detected and terminated even without a pid-file.

Test plan

  • With agent.pid deleted and an orphan agent running: ./dev status reports the orphan as running with its real pid
  • ./dev restart agent kills the orphan and the new agent starts cleanly, rewriting agent.pid
  • ./dev restart all restarts every service; all 7 report running and both agents are ALIVE in the manager DB
  • sftp-agent (pid-file present) is left untouched by compute-agent operations

Resolves #14957 (BA-8114)

🤖 Generated with Claude Code

…e is missing

The dev script identified agent/sftp-agent solely by their pid-files, so a
missing agent.pid made restart skip the stop: the orphan agent kept its
ports and the freshly started agent died on bind (Errno 98) with its tmux
window closing traceless. Resolve the agent pid via the pid-file first and
fall back to the listener of the rpc-listen-addr port from the service's
toml, walking up from the worker to the main process.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 23, 2026 02:21
@agatha197
agatha197 requested a review from a team as a code owner September 23, 2026 02:21
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agatha197
agatha197 marked this pull request as draft September 23, 2026 02:22
@agatha197
agatha197 marked this pull request as ready for review September 23, 2026 02:23
@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 14 days and has been marked as stale. It will be closed on 2026-10-27 (in 14 days) if no further activity occurs. Push a commit or leave a comment to keep it open.

@github-actions github-actions Bot added the stale label Oct 13, 2026
@fregataa
fregataa merged commit a871181 into main Oct 22, 2026
33 checks passed
@fregataa
fregataa deleted the fix/BA-8114-dev-agent-pid-fallback branch October 22, 2026 15:23
lablup-octodog added a commit that referenced this pull request Oct 22, 2026
…e is missing (#14958) (#16010)

Co-authored-by: Sujin Kim <kimsujin@lablup.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
lablup-octodog added a commit that referenced this pull request Oct 22, 2026
…e is missing (#14958) (#16011)

Co-authored-by: Sujin Kim <kimsujin@lablup.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev script: restart silently leaves an orphan agent when agent.pid is missing, and the new agent dies on port conflict

4 participants