git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Taylor Blau <me@ttaylorr.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] receive-pack: fix stale packfile locks when dying
Date: Fri, 10 Mar 2023 03:51:29 -0500	[thread overview]
Message-ID: <ZArvkVPhF4Th424Z@coredump.intra.peff.net> (raw)
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

  reply	other threads:[~2023-03-10  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 13:09 [PATCH] receive-pack: fix stale packfile locks when dying Patrick Steinhardt
2023-03-09 15:59 ` Jeff King
2023-03-10  6:24   ` Patrick Steinhardt
2023-03-10  8:37     ` Jeff King
2023-03-09 18:26 ` Taylor Blau
2023-03-09 18:48 ` Junio C Hamano
2023-03-09 18:49   ` Junio C Hamano
2023-03-10  6:52 ` [PATCH v2] " Patrick Steinhardt
2023-03-10  8:51   ` Jeff King [this message]
2023-03-10 11:49     ` Patrick Steinhardt
2023-03-10 13:20       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZArvkVPhF4Th424Z@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).