From: Ben Knoble Date: Thu, 18 Dec 2025 03:38:24 GMT Subject: Re: [PATCH v2] lockfile: add PID file for debugging stale locks Message-ID: <211B172F-303C-48F6-9B2E-ABF6DDBCA662@gmail.com> In-Reply-To: > Le 17 déc. 2025 à 13:59, Paulo Casaretto via GitGitGadget a écrit : > > From: Paulo Casaretto > > 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 ") 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.