Return-Path: Received: from mail5.wrs.com (mail5.windriver.com [192.103.53.11]) by mail.openembedded.org (Postfix) with ESMTP id 5AA0B7C254 for ; Fri, 25 Jan 2019 19:54:50 +0000 (UTC) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id x0PJrOBj024969 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 25 Jan 2019 11:53:34 -0800 Received: from soho-mhatle-m.local (172.25.36.226) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server id 14.3.408.0; Fri, 25 Jan 2019 11:53:27 -0800 To: Stefan Agner , Richard Purdie References: <1548427287-11934-1-git-send-email-liu.ming50@gmail.com> <238483ee79cc017f2b6603d562c26cb18036a037.camel@linuxfoundation.org> <7d80c538faadfdc9d2259bc37956835b@agner.ch> From: Mark Hatle Openpgp: preference=signencrypt Autocrypt: addr=mark.hatle@windriver.com; prefer-encrypt=mutual; keydata= mQENBFYKxFgBCACt/pzutBp6p/xVKTFJjHbM3KpQKCblyot/YP+bpTr51Hrc5xDXBQhoG7TC aIRvRIvbhEevEQK9y04gW3JK/5lobq5ORebolcsHlYBUvpNeIPjupLQwGvz/TPtrLRNGLqDC rvsM6OA2XbQ2bwzxWaSQS3ImE2O2iXOZn9HhThMGeDB4Nff3fgUvXOTDIrgWOn9K2DgLL7Yc zkUIlFdj+Nraksd/7BSk8oH6tjeBVhFqSFvKta9QxWgdr58oPaTYaW/xNqUjlLrbJuMw/MSe xzuYfdfDfm6J8kRjMOnwQ0n8svJElzqAk+d83ow38gpGQ+LkjGgnf8ZFJ4rUJFADroX3ABEB AAG0JU1hcmsgSGF0bGUgPG1hcmsuaGF0bGVAd2luZHJpdmVyLmNvbT6JATcEEwEIACEFAlYK xFgCGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQfv796/r0vvlvZAf9Gs+eN320yhRW V/fZCsngKhmOK4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message-ID: Date: Fri, 25 Jan 2019 13:53:26 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <7d80c538faadfdc9d2259bc37956835b@agner.ch> Cc: bitbake-devel@lists.openembedded.org, luka.pivk@toradex.com, stefan.agner@toradex.com, liu.ming50@gmail.com Subject: Re: [PATCH V2] fetch2/gitsm: fix config file concurrent update race X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2019 19:54:50 -0000 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Is the repository you are using public? If so, give me the URL and commit ID for the main repository and I'll get it added to the test suite. (For testing what I've been doing is checking out with raw git and then with the gitsm fetcher.. comparing the difference and then adding those specific things as regressions checks.) If it's not public, then you'll likely need to do that yourself. Compare the results and try to figure out what the difference is. Once you have that, it may be more obvious what the problems. (Comparison should include the .git contents as well..) --Mark On 1/25/19 1:24 PM, Stefan Agner wrote: > On 25.01.2019 16:08, Richard Purdie wrote: >> On Fri, 2019-01-25 at 15:41 +0100, liu.ming50@gmail.com wrote: >>> From: Ming Liu >>> >>> A following issue was observed with gitsm: >>>> git -c core.fsyncobjectfiles=0 config submodule... failed with exit code 255, output: >>>> error: could not lock config file config: File exists >>> >>> Since all git submodules share a config file and Git creates a lock >>> file (.git/config.lock) to synchronize access to it, but Git only tries >>> exactly once and returns a error if it's already locked. This leads to >>> a race condition if there are many 'git config submodule' run in >>> different processes. >>> >>> It could be fixed by introducing a bitbake file lock to protect config >>> file from concurrent update from submodules. >>> >>> Reported-by: Stefan Agner >>> Signed-off-by: Ming Liu >>> --- >>> lib/bb/fetch2/gitsm.py | 16 ++++++++++++---- >>> 1 file changed, 12 insertions(+), 4 deletions(-) >>> >>> diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch2/gitsm.py >>> index f45546b..9465acb 100644 >>> --- a/lib/bb/fetch2/gitsm.py >>> +++ b/lib/bb/fetch2/gitsm.py >>> @@ -183,11 +183,19 @@ class GitSM(Git): >>> >>> local_path = newfetch.localpath(url) >>> >>> - # Correct the submodule references to the local download version... >>> - runfetchcmd("%(basecmd)s config submodule.%(module)s.url %(url)s" % {'basecmd': ud.basecmd, 'module': module, 'url' : local_path}, d, workdir=ud.destdir) >>> + # Protects the config file from concurrent updates by submodules >>> + # e.g. 'git config submodule' run in different processes may lead >>> + # to a race condition. >>> + lf = bb.utils.lockfile(os.path.join(ud.destdir, "gitsm-config.lock")) >>> >>> - if ud.shallow: >>> - runfetchcmd("%(basecmd)s config submodule.%(module)s.shallow true" % {'basecmd': ud.basecmd, 'module': module}, d, workdir=ud.destdir) >>> + try: >>> + # Correct the submodule references to the local download version... >>> + runfetchcmd("%(basecmd)s config submodule.%(module)s.url %(url)s" % {'basecmd': ud.basecmd, 'module': module, 'url' : local_path}, d, workdir=ud.destdir) >>> + >>> + if ud.shallow: >>> + runfetchcmd("%(basecmd)s config submodule.%(module)s.shallow true" % {'basecmd': ud.basecmd, 'module': module}, d, workdir=ud.destdir) >>> + finally: >>> + bb.utils.unlockfile(lf) >>> >>> # Ensure the submodule repository is NOT set to bare, since we're checking it out... >>> try: >> >> I still don't see why this is necessary after Mark's recent changes. >> These files are in ud.destdir which in OE terms is WORKDIR. Only one >> fetch happens against WORKDIR at a time? Therefore how is this racing? > > The git config race we only observed before the recent changes by Mark. > > If those changes have the potential to fix this issue, we should test > those first and hold on with this patch. > >> >> Have you seen this problem against the current master code? > > Master as of yesterday (or Wednesday) was not able to fetch the project > (aktualizr). > > Even with the latest 2 fixes I am not able to build the (very same) > recipe anymore, it ends up in an error during do_configure, presumably > due to missing submodules: > > > | -- Configuring done > | CMake Error at partial/CMakeLists.txt:116 (add_library): > | Cannot find source file: > | > > | extern/isotp-c/deps/bitfield-c/src/bitfield/8byte.c > > | > > | Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ > .hm > | .hpp .hxx .in .txx > | > | > | CMake Error at partial/CMakeLists.txt:116 (add_library): > | No SOURCES given to target: isotp > | > > Using c1fcc46e2498 ("bitbake: Fix Deprecated warnings from regexs") > works fine. > > -- > Stefan > >