fix(daemon): recover stale service PID files safely - #1469
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe daemon now uses typed PID mismatch errors and explicit process identity checks. Startup removes a confirmed stale PID file without signaling the unrelated process. Tests cover concurrent recovery, shell identity validation, and unavailable process identities. ChangesDaemon PID handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Daemon startup now safely replaces confirmed stale PID files without signaling unrelated processes, while preserving fail-closed handling for unknown identities. The covered recovery and idempotence behavior is ready to merge. Sequence Diagram(s)sequenceDiagram
participant Start
participant Running
participant serviceProcessIdentity
participant PIDFile
Start->>Running: Check recorded PID
Running->>serviceProcessIdentity: Identify recorded PID
serviceProcessIdentity-->>Running: Confirm foreign process
Running-->>Start: Return servicePIDMismatchError
Start->>PIDFile: Re-read and remove unchanged stale PID
Start-->>Start: Launch service
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Start, under the existing start gate, without signaling that process or changing PID-file format.StopandRestartstill refuse unrelated PIDs.Ref ZaparooProject/Main_MiSTer#24. This is the Core-owned cleanup companion to Main's watchdog identity check; Core should ship before relying on automatic PID-reuse recovery.
Validated with
task test,task lint,task deadlock,task cross-lint:allandtask vulncheck. Original code failed the recovery regression. Vulnerability scan reports no called vulnerable code; it notes uncalled dependency advisories. No device service, deployment or release changes. Work isolated from the owner's active checkout.Summary by CodeRabbit