summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCaner Altinbasak <cal@brightsign.biz>2021-10-25 22:15:51 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-25 20:54:25 +0100
commita89560d336d62b2ab474565980bbf769e7a0bea3 (patch)
tree7010ee18f6b2d250d623b85b2d01462a623e58f5 /bitbake
parent94c640301c0959733d97e701d0a569a2180f6351 (diff)
downloadpoky-a89560d336d62b2ab474565980bbf769e7a0bea3.tar.gz
bitbake: npmsw: Avoid race condition with multiple npm fetchers
If multiple npmsw fetchers are trying to download the same npm file, one of them can try to download the file while other is calling verify. npmsw methods gets called without holding the lock, which causes race conditions in fetching and verification etc. Lock the lockfile before calling proxy fetcher methods. (Bitbake rev: 591a05d6126f29b501b9fa284c0618de8c903c69) Signed-off-by: Caner Altinbasak <cal@brightsign.biz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit fa39e6689d0f0fff772e1c81682698f4b1587b8a) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/npmsw.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/npmsw.py b/bitbake/lib/bb/fetch2/npmsw.py
index 0c3511d8ab..fdecbc6db6 100644
--- a/bitbake/lib/bb/fetch2/npmsw.py
+++ b/bitbake/lib/bb/fetch2/npmsw.py
@@ -29,6 +29,8 @@ from bb.fetch2.npm import npm_integrity
29from bb.fetch2.npm import npm_localfile 29from bb.fetch2.npm import npm_localfile
30from bb.fetch2.npm import npm_unpack 30from bb.fetch2.npm import npm_unpack
31from bb.utils import is_semver 31from bb.utils import is_semver
32from bb.utils import lockfile
33from bb.utils import unlockfile
32 34
33def foreach_dependencies(shrinkwrap, callback=None, dev=False): 35def foreach_dependencies(shrinkwrap, callback=None, dev=False):
34 """ 36 """
@@ -187,7 +189,9 @@ class NpmShrinkWrap(FetchMethod):
187 proxy_ud = ud.proxy.ud[proxy_url] 189 proxy_ud = ud.proxy.ud[proxy_url]
188 proxy_d = ud.proxy.d 190 proxy_d = ud.proxy.d
189 proxy_ud.setup_localpath(proxy_d) 191 proxy_ud.setup_localpath(proxy_d)
192 lf = lockfile(proxy_ud.lockfile)
190 returns.append(handle(proxy_ud.method, proxy_ud, proxy_d)) 193 returns.append(handle(proxy_ud.method, proxy_ud, proxy_d))
194 unlockfile(lf)
191 return returns 195 return returns
192 196
193 def verify_donestamp(self, ud, d): 197 def verify_donestamp(self, ud, d):