summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-19 17:59:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-20 16:45:25 +0000
commitf37af44f18f410e147b5a70c44f65563fe218e19 (patch)
treefabe7feeb6fa107391c0feee5d88f007a933d54c /meta/classes/sstate.bbclass
parent9477a309a8bb5ad5840e9caef234c8112fc31528 (diff)
downloadpoky-f37af44f18f410e147b5a70c44f65563fe218e19.tar.gz
sstate: Setup fetcher environment in advance
The threading code here can race as the fetcher changes the environment which is shared between the threads. By setting it up in advance, it isn't changed and therefore no longer races. (From OE-Core rev: cabc3cc2eac5916e63340c18d1074411b377ced4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass21
1 files changed, 12 insertions, 9 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 54edf0bec6..86bf0395d2 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -1022,15 +1022,18 @@ def sstate_checkhashes(sq_data, d, siginfo=False, currentcount=0, summary=True,
1022 msg = "Checking sstate mirror object availability" 1022 msg = "Checking sstate mirror object availability"
1023 bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d) 1023 bb.event.fire(bb.event.ProcessStarted(msg, len(tasklist)), d)
1024 1024
1025 bb.event.enable_threadlock() 1025 # Have to setup the fetcher environment here rather than in each thread as it would race
1026 pool = oe.utils.ThreadedPool(nproc, len(tasklist), 1026 fetcherenv = bb.fetch2.get_fetcher_environment(d)
1027 worker_init=checkstatus_init, worker_end=checkstatus_end, 1027 with bb.utils.environment(**fetcherenv):
1028 name="sstate_checkhashes-") 1028 bb.event.enable_threadlock()
1029 for t in tasklist: 1029 pool = oe.utils.ThreadedPool(nproc, len(tasklist),
1030 pool.add_task(checkstatus, t) 1030 worker_init=checkstatus_init, worker_end=checkstatus_end,
1031 pool.start() 1031 name="sstate_checkhashes-")
1032 pool.wait_completion() 1032 for t in tasklist:
1033 bb.event.disable_threadlock() 1033 pool.add_task(checkstatus, t)
1034 pool.start()
1035 pool.wait_completion()
1036 bb.event.disable_threadlock()
1034 1037
1035 if progress: 1038 if progress:
1036 bb.event.fire(bb.event.ProcessFinished(msg), d) 1039 bb.event.fire(bb.event.ProcessFinished(msg), d)