git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: "Git List" <git@vger.kernel.org>,
	"Marketa Calabkova" <mcalabkova@suse.cz>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH v3 2/2] setup: don't fail if commondir reference is deleted.
Date: Thu, 21 Feb 2019 04:27:21 -0500	[thread overview]
Message-ID: <CAPig+cT48d9JJyqVx0WvBiFV+BLqAqo5dX3yndNhoJZmKRPgEg@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cS4vZpyj4Cx=Q89v3xTrCG4WbtX8EhTfOT2RKytjV-HrA@mail.gmail.com>

On Wed, Feb 20, 2019 at 1:35 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Wed, Feb 20, 2019 at 12:16 PM Michal Suchánek <msuchanek@suse.de> wrote:
> > On Wed, 20 Feb 2019 11:55:46 -0500
> > Eric Sunshine <sunshine@sunshineco.com> wrote:
> > > On Wed, Feb 20, 2019 at 11:17 AM Michal Suchanek <msuchanek@suse.de> wrote:
> > > > Another even rarer issue is that the file might be zero size because another
> > > > process initializing a worktree opened the file but has not written is content
> > > > yet.
> > >
> > > Based upon the explanation thus far, I'm having trouble understanding
> > > under what circumstances these race conditions can arise. Are you
> > > trying to invoke Git commands in a particular worktree even as the
> > > worktree itself is being created?
> >
> > It's explained in the following paragraph. If you have multiple
> > worktrees some *other* worktreee may be uninitialized.
>
> I understand that, but setup.c:get_common_dir_noenv() is concerned
> only with _this_ worktree -- the one in which the Git command is being
> run -- so it's not clear if or how some other partially-initialized
> worktree could have any impact. (And, I'm having trouble fathoming how
> it could, which is why I'm asking these questions).

I still can't see how setup.c:get_common_dir_noenv() could be
responsible for the behavior you're describing of _any_ Git command
erroring out due to _any_ worktree being incompletely-initialized.
However, I can imagine "git worktree add" itself being racy and
failing due to a missing or empty "commondir" file for some other
worktree since that command _does_ consult other worktree entries when
validating the "add" operation via
builtin/worktree.c:validate_worktree_add() which calls
get_worktrees(). If get_worktrees() is subject to that raciness
problem, then "git worktree add" will inherit that undesirable
raciness behavior (as will other "git worktree" commands which call
get_worktrees(), such as "git worktree list").

> Is it possible that when you saw that error message, it actually arose
> from some code other than setup.c:get_common_dir_noenv()?

So, I'm suspecting get_worktrees() or some function it calls (and so
on) as the racy culprit.

  reply	other threads:[~2019-02-21  9:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 17:04 [PATCH 0/2] worktree add race fix Michal Suchanek
2019-02-18 17:04 ` [PATCH 1/2] worktree: fix worktree add race Michal Suchanek
2019-02-18 17:04 ` [PATCH 2/2] setup: don't fail if commondir reference is deleted Michal Suchanek
2019-02-18 21:00   ` Eric Sunshine
2019-02-21 10:50   ` Duy Nguyen
2019-02-21 13:50     ` Michal Suchánek
2019-02-21 17:07       ` Phillip Wood
2019-02-21 17:12         ` Eric Sunshine
2019-02-21 17:27           ` Phillip Wood
2019-03-04 13:30             ` Michal Suchánek
2019-02-21 17:33           ` Michal Suchánek
2019-02-22  9:32         ` Duy Nguyen
2019-02-22 10:20           ` Phillip Wood
2019-02-22  9:26       ` Duy Nguyen
2019-02-20 16:16 ` [PATCH v3 1/2] worktree: fix worktree add race Michal Suchanek
2019-02-20 16:34   ` Eric Sunshine
2019-02-20 17:29     ` Michal Suchánek
2019-03-08  9:20   ` Duy Nguyen
2019-03-08  9:37     ` Eric Sunshine
2019-03-11  1:55     ` Junio C Hamano
2019-02-20 16:16 ` [PATCH v3 2/2] setup: don't fail if commondir reference is deleted Michal Suchanek
2019-02-20 16:55   ` Eric Sunshine
2019-02-20 17:16     ` Michal Suchánek
2019-02-20 18:35       ` Eric Sunshine
2019-02-21  9:27         ` Eric Sunshine [this message]
2019-02-21 11:13           ` Michal Suchánek
2019-02-21 11:19         ` Michal Suchánek

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=CAPig+cT48d9JJyqVx0WvBiFV+BLqAqo5dX3yndNhoJZmKRPgEg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mcalabkova@suse.cz \
    --cc=msuchanek@suse.de \
    --cc=pclouds@gmail.com \
    /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).