<div dir="ltr"><div dir="ltr"><div>Hi, Richard:</div><div><br></div><div>Involve in Mark.</div><div><br></div><div>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&#39;s inside the GitSM unpack function, the call chain is:</div><div><br></div><div>Inside GitSM:</div><div>```</div><div>def unpack</div><div>  -&gt; for module in submodules:</div><div>       -&gt; unpack_submodules </div><div>            -&gt; runfetchcmd</div><div>                 -&gt; bb.process.run</div><div>                      -&gt; git config submodule</div><div>```</div><div><br></div><div>since &#39;git config submodule&#39; run concurrently and try to modify a same git config file, hence the race might happen, but it&#39;s hard to be reproduced since &#39;git config submodule&#39; finishes quite quickly.</div><div><br></div><div>//Ming Liu</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&gt; 於 2019年1月25日 週五 下午1:24寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 2019-01-25 at 12:35 +0100, Ming Liu wrote:<br>
&gt; Hi, Stefan:<br>
&gt; <br>
&gt; Could you help confirm this? <br>
&gt; <br>
&gt; Hi, Richard:<br>
&gt; <br>
&gt; May I know how has the issue been fixed?<br>
&gt;<br>
&gt; I updated the tip to:<br>
&gt; ```<br>
&gt; commit 8c8ecec2a722bc2885e2648d41ac8df07bdf660d<br>
&gt;     gitsmy.py: Fix unpack of submodules of submodules<br>
&gt;     <br>
&gt;     If the submodule is in a subdirectory, it needs to have that<br>
&gt; structure<br>
&gt;     preserved.  This means the unpack path needs to be in the<br>
&gt; &#39;dirname&#39; of the<br>
&gt;     final path -- since the unpack directory name is specified in the<br>
&gt; URI.<br>
&gt;     <br>
&gt;     Additional specific test cases were added to ensure this is<br>
&gt; working properly<br>
&gt;     based on two recent error reports.<br>
&gt;     <br>
&gt;     Signed-off-by: Mark Hatle &lt;<a href="mailto:mark.hatle@windriver.com" target="_blank">mark.hatle@windriver.com</a>&gt;<br>
&gt;     Signed-off-by: Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a><br>
&gt; &gt;<br>
&gt; ```<br>
&gt; on top of that commit, I could see there are &quot;git config submodule&quot;<br>
&gt; being called concurrently in different processes, which does have a<br>
&gt; race condition, and will lead to the error observed by Stefan,<br>
&gt; although it&#39;s not easy to be reproduced.<br>
<br>
There are locks at a higher level in the fetchers, in<br>
lib/bb/fetch2/__init__.py the download() method has:<br>
<br>
if ud.lockfile:<br>
    lf = bb.utils.lockfile(ud.lockfile)<br>
<br>
and the unpack() method has similar locks.<br>
<br>
Mark and I believe there were some code paths where the locks were<br>
being bypassed in the gitsm fetcher but Mark reworked the code so that<br>
we were both happy that there should always be a lock held.<br>
<br>
We need to fix any races properly ensuring they&#39;re covered by the main<br>
fetcher locks, adding new ones would only fix a symptom of the real<br>
problem.<br>
<br>
Cheers,<br>
<br>
Richard<br>
<br>
<br>
<br>
</blockquote></div>