acquireProcessLock (docker-workload/process-lock.ts)

ironcurtain · src/docker-workload/process-lock.ts · typescript · Apache-2.0
infra

* Crash-recoverable host-process lock used by Docker-workload lifecycle state. A complete owner record is written and fsynced under a unique candidate name, then published with an atomic hard link. Contenders therefore never observe the old `O_EXCL create -> empty file -> owner J

// Source: https://github.com/provos/ironcurtain | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Crash-recoverable host-process lock used by Docker-workload lifecycle state.
 *
 * A complete owner record is written and fsynced under a unique candidate name,
 * then published with an atomic hard link. Contenders therefore never observe
 * the old `O_EXCL create -> empty file -> owner JSON` publication window.
 *
 * Ownership is a tuple of PID, OS-reported process-start identity, and a random
 * token. PID alone is insufficient because it can be reused after a crash or a
 * reboot. Reclaiming a dead owner's lock captures the exact observed inode with
 * a rename and deletes o

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key