git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Adina Wagner <a.wagner@fz-juelich.de>
Cc: git@vger.kernel.org
Subject: Re: suspected race between packing and fetch (single case study)
Date: Fri, 8 Jan 2021 13:48:40 -0500	[thread overview]
Message-ID: <X/ipCPFyW3gAWrHo@nand.local> (raw)
In-Reply-To: <e7301aaf-b341-ec0b-9e2d-ab7f60ac58da@fz-juelich.de>

Hi Adina,

On Fri, Jan 08, 2021 at 05:39:12PM +0100, Adina Wagner wrote:
> Hi,
>
>
> colleagues encouraged me to report a "personal" bug I've stumbled
> across. Its "personal", because I wasn't able to create a minimal
> reproducer, or even reproduce it with the same script on other
> infrastructure. We're suspecting a race between packing and fetch. The
> script I am using is at the bottom of the email.

Indeed, similar races between fetching and repacking are known. For
example, this discussion:

  https://lore.kernel.org/git/20200316082348.GA26581@inner.h.apk.li/

is about the .idx going away during a fetch. A similar thing is
happening here, but instead of the .idx file going away, your source
repository is repacking (and thus getting rid of loose object files).

Here, I think the issue is less complicated. Since you're cloning from a
local repository, the 'git clone' command calls 'clone_local()', which
in turn calls 'copy_or_link_directory()'. If the directory being copied
changes while being iterated over, the receiving end isn't guaranteed to
pick up the changes.

Worse, if the source _removes_ a file that hasn't yet been copied, over,
then the copy will fail, which is what you're seeing here.

One workaround would be to clone your repositories locally with
'--shared', which won't copy any objects from the source repository, but
instead mark its object store as an alternate to the newly created one.

> I wonder if there is a way that Git could guard cases where background
> gc processes may still be running?

Perhaps Git could take some sort of lock when writing to the object
store, but an flock wouldn't work since we'd want to allow multiple
readers to acquire the lock simultaneously, so long as there is no
writer.


Thanks,
Taylor

  reply	other threads:[~2021-01-08 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fe9babc8-a3ee-6be4-e4f8-9690cb7c79bd@fz-juelich.de>
2021-01-08 16:39 ` suspected race between packing and fetch (single case study) Adina Wagner
2021-01-08 18:48   ` Taylor Blau [this message]
2021-01-09 22:11     ` Junio C Hamano
2021-01-11 19:25       ` Taylor Blau
2021-01-12 17:46         ` yoh
2021-01-12 18:47           ` Taylor Blau
2021-01-13 14:55             ` yoh

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

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

  git send-email \
    --in-reply-to=X/ipCPFyW3gAWrHo@nand.local \
    --to=me@ttaylorr.com \
    --cc=a.wagner@fz-juelich.de \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).