Skip to content

bug(a2a): daemon PID file not cleaned on abnormal exit — restart requires manual cleanup #2295

@bug-ops

Description

@bug-ops

Summary

The A2A daemon writes a PID file to ~/.zeph/zeph.pid on startup but does not clean it on abnormal termination (SIGKILL, crash). On the next launch, the daemon detects the stale PID file and fails to start cleanly.

Steps to reproduce

  1. Start daemon: ./target/debug/zeph --config ... --daemon
  2. Kill it with SIGKILL: kill -9 <pid>
  3. Restart daemon — sees: WARN zeph::daemon: failed to write PID file: File exists (os error 17)

Expected

Daemon should check if the PID in the file is actually alive. If the process is dead (stale PID), clean the file and proceed. Or use atomic PID file semantics (lock file).

Actual

Daemon prints a WARN and continues, but subsequent starts are unreliable. If the old process was a different binary, both can coexist without coordination.

Workaround

rm -f ~/.zeph/zeph.pid before restarting.

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitybugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions