All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Liu <liu.ming50@gmail.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>,
	mark.hatle@windriver.com
Cc: bitbake-devel@lists.openembedded.org,
	Stefan Agner <stefan.agner@toradex.com>,
	Luka Pivk <luka.pivk@toradex.com>
Subject: Re: [PATCH] fetch2/gitsm: fix config file concurrent update race
Date: Fri, 25 Jan 2019 14:44:57 +0100	[thread overview]
Message-ID: <CALatG=5tuk+qOc3D67wFpP=bnPxxyP4r-K=5wD2ieVgMYEhD+Q@mail.gmail.com> (raw)
In-Reply-To: <1dbceb752ca54fcbb32c4c4325272b80670693f4.camel@linuxfoundation.org>

[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]

Hi, Richard:

Involve in Mark.

Please correct me if I am wrong, but according to the code, seems these
upper level locks could not protect this race condition, because it's
inside the GitSM unpack function, the call chain is:

Inside GitSM:
```
def unpack
  -> for module in submodules:
       -> unpack_submodules
            -> runfetchcmd
                 -> bb.process.run
                      -> git config submodule
```

since 'git config submodule' run concurrently and try to modify a same git
config file, hence the race might happen, but it's hard to be reproduced
since 'git config submodule' finishes quite quickly.

//Ming Liu

Richard Purdie <richard.purdie@linuxfoundation.org> 於 2019年1月25日 週五
下午1:24寫道:

> On Fri, 2019-01-25 at 12:35 +0100, Ming Liu wrote:
> > Hi, Stefan:
> >
> > Could you help confirm this?
> >
> > Hi, Richard:
> >
> > May I know how has the issue been fixed?
> >
> > I updated the tip to:
> > ```
> > commit 8c8ecec2a722bc2885e2648d41ac8df07bdf660d
> >     gitsmy.py: Fix unpack of submodules of submodules
> >
> >     If the submodule is in a subdirectory, it needs to have that
> > structure
> >     preserved.  This means the unpack path needs to be in the
> > 'dirname' of the
> >     final path -- since the unpack directory name is specified in the
> > URI.
> >
> >     Additional specific test cases were added to ensure this is
> > working properly
> >     based on two recent error reports.
> >
> >     Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> >     Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org
> > >
> > ```
> > on top of that commit, I could see there are "git config submodule"
> > being called concurrently in different processes, which does have a
> > race condition, and will lead to the error observed by Stefan,
> > although it's not easy to be reproduced.
>
> There are locks at a higher level in the fetchers, in
> lib/bb/fetch2/__init__.py the download() method has:
>
> if ud.lockfile:
>     lf = bb.utils.lockfile(ud.lockfile)
>
> and the unpack() method has similar locks.
>
> Mark and I believe there were some code paths where the locks were
> being bypassed in the gitsm fetcher but Mark reworked the code so that
> we were both happy that there should always be a lock held.
>
> We need to fix any races properly ensuring they're covered by the main
> fetcher locks, adding new ones would only fix a symptom of the real
> problem.
>
> Cheers,
>
> Richard
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3583 bytes --]

  reply	other threads:[~2019-01-25 13:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 10:57 [PATCH] fetch2/gitsm: fix config file concurrent update race liu.ming50
2019-01-25 11:18 ` Richard Purdie
2019-01-25 11:35   ` Ming Liu
2019-01-25 12:23     ` Richard Purdie
2019-01-25 13:44       ` Ming Liu [this message]
2019-01-25 14:10         ` Richard Purdie
2019-01-25 14:23           ` Ming Liu
2019-01-25 16:53         ` Mark Hatle
2019-01-25 16:42     ` Mark Hatle

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='CALatG=5tuk+qOc3D67wFpP=bnPxxyP4r-K=5wD2ieVgMYEhD+Q@mail.gmail.com' \
    --to=liu.ming50@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=luka.pivk@toradex.com \
    --cc=mark.hatle@windriver.com \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=stefan.agner@toradex.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.