Re: [PATCH v2] lockfile: add PID file for debugging stale locks
Show 17 quoted lines
> Le 17 déc. 2025 à 13:59, Paulo Casaretto via GitGitGadget <gitgitgadget@gmail.com> a écrit :
>
> From: Paulo Casaretto <pcasaretto@gmail.com>
>
> When a lock file is held, it can be helpful to know which process owns
> it, especially when debugging stale locks left behind by crashed
> processes. Add an optional feature that creates a companion PID file
> alongside each lock file, containing the PID of the lock holder.
>
> For a lock file "foo.lock", the PID file is named "foo.pid.lock". The
> file uses a simple key-value format ("pid <value>") following the same
> pattern as Git object headers, making it extensible for future metadata.
>
> The PID file is created when a lock is acquired (if enabled), and
> automatically cleaned up when the lock is released (via commit or
> rollback). The file is registered as a tempfile so it gets cleaned up
> by signal and atexit handlers if the process terminates abnormally.Do we also release locks when the process terminates abnormally? If not, this info would be lost during a crash, which I assume is when it would be very useful 🤔 I haven’t looked, just curiously wondering.