mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 16:03:45 +00:00
A crash, power loss, or forced kill mid-write left a torn, unparseable daemon-vN.pid at the canonical path. For a retired protocol version nothing ever heals that record (stale-kill only reclaims the current version's), so the corrupt file became a permanent veto on pruning that version. Publish now writes a per-pid/per-uuid claim, fsyncs it, and hard-links it into place: readers see a complete record or none, and EEXIST ownership conflicts are preserved (rename would silently replace). Filesystems that refuse hard links degrade to the previous exclusive direct write. Claims are cleaned on every in-process failure path; crash-orphaned claims are reaped at the launch funnel, gated on the owner pid being provably dead (ESRCH), never on age.