git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] receive-pack: fix stale packfile locks when dying

From
Jeff King <peff@peff.net>
Date
Mar 10, 2023, 08:51 UTC
Message-ID
<ZArvkVPhF4Th424Z@coredump.intra.peff.net>
In-Reply-To
<e1ee1d8026a361bc58d16bc741e2b347ada7a53e.1678431076.git.ps@pks.im>
On Fri, Mar 10, 2023 at 07:52:10AM +0100, Patrick Steinhardt wrote:
> Fix this race by registering the lockfile as a tempfile so that it will
> automatically be removed at exit or when receiving a signal.
Unsurprisingly, this version looks good to me. :)

Looks like you adjusted for index_pack_lockfile() returning NULL, which makes sense.

>  builtin/receive-pack.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

There's no test here, and I think we _could_ make a reliable one with something like:

  1. Have a proc-receive hook that signals via fifo that it's running,
     then pauses indefinitely.
  2. Start a push in the background, then wait on the fifo signal.
  3. Kill receive-pack.

But it's awfully complicated for little gain. I'm fine with not worrying about it (and I did something similar manually to make to sure it works as we expect).

-Peff
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 11 in “receive-pack: fix stale packfile locks when dying”
  1. receive-pack: fix stale packfile locks when dyingPatrick Steinhardt, Mar 9, 2023
  2. Jeff KingMar 9, 2023
  3. Patrick SteinhardtMar 10, 2023
  4. Jeff KingMar 10, 2023
  5. Taylor BlauMar 9, 2023
  6. Junio C HamanoMar 9, 2023
  7. Junio C HamanoMar 9, 2023
  8. receive-pack: fix stale packfile locks when dyingPatrick Steinhardt, Mar 10, 2023
  9. Jeff KingMar 10, 2023
  10. Patrick SteinhardtMar 10, 2023
  11. Jeff KingMar 10, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.