Skip to content

fix: RAII socket cleanup and hardened daemon shutdown#23

Merged
jleni merged 1 commit intomainfrom
fix/socket-cleanup-guard
Apr 8, 2026
Merged

fix: RAII socket cleanup and hardened daemon shutdown#23
jleni merged 1 commit intomainfrom
fix/socket-cleanup-guard

Conversation

@jleni
Copy link
Copy Markdown
Member

@jleni jleni commented Apr 8, 2026

Summary

  • SocketCleanupGuard: RAII guard that removes the Unix socket file on drop, ensuring cleanup even if server_main exits early (panic, ? bail), preventing stale sockets from blocking future daemon starts.
  • Hardened shutdown: send_shutdown_request now falls back to SIGTERM → SIGKILL via the coordinator PID when the socket is unreachable but the daemon process is still alive.

Test plan

  • kache daemon stop works when daemon is healthy
  • kache daemon stop recovers when socket is stale but process is alive
  • Daemon restart after crash does not hang on stale socket

- Add SocketCleanupGuard to remove the Unix socket on drop, preventing
  stale sockets from blocking future daemon starts after early exits
- Harden send_shutdown_request with SIGTERM/SIGKILL fallback when the
  socket is unreachable but the daemon process is still alive
@jleni jleni force-pushed the fix/socket-cleanup-guard branch from d4e6f20 to 9f05592 Compare April 8, 2026 12:53
@jleni jleni merged commit 263e8d2 into main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant