Skip to contentSkip to conversation

classes/sstate.bbclass: Enable thread lock when checkstatus

PATCH In review Aníbal Limón 1 participant 2 messages Oct 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes/sstate.bbclass: Enable thread lock when checkstatus

The checkstatus function fires an event to notify bitbake UI about the progress of the task, this function is implemented using ThreadPool and is causing event lose when multiple threads tries to fire an event (writes over socket/fd).

[YOCTO #10330]

---
 meta/classes/sstate.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/sstate.bbclass +4 -0
index 6f0c791..172384b 100644
@@ -851,15 +851,19 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
 
         if tasklist:
             bb.event.fire(bb.event.ProcessStarted("Checking sstate mirror object availability", len(tasklist)), d)
+
             import multiprocessing
             nproc = min(multiprocessing.cpu_count(), len(tasklist))
 
+            bb.event.enable_threadlock()
             pool = oe.utils.ThreadedPool(nproc, len(tasklist),
                     worker_init=checkstatus_init, worker_end=checkstatus_end)
             for t in tasklist:
                 pool.add_task(checkstatus, t)
             pool.start()
             pool.wait_completion()
+            bb.event.disable_threadlock()
+
             bb.event.fire(bb.event.ProcessFinished("Checking sstate mirror object availability"), d)
             if whitelist and missing:
                 bb.fatal('Required artifacts were unavailable - exiting')
Signature · 1 line
2.1.4
#1 lore raw

This patch depends on bitbake one,

http://lists.openembedded.org/pipermail/bitbake-devel/2016-October/008129.html

Cheers,
alimon

Quoted 37 lines · Aníbal Limón

The checkstatus function fires an event to notify bitbake UI about the progress of the task, this function is implemented using ThreadPool and is causing event lose when multiple threads tries to fire an event (writes over socket/fd).

[YOCTO #10330]

---
 meta/classes/sstate.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/sstate.bbclass +4 -0
index 6f0c791..172384b 100644
@@ -851,15 +851,19 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
 
         if tasklist:
             bb.event.fire(bb.event.ProcessStarted("Checking sstate mirror object availability", len(tasklist)), d)
+
             import multiprocessing
             nproc = min(multiprocessing.cpu_count(), len(tasklist))
 
+            bb.event.enable_threadlock()
             pool = oe.utils.ThreadedPool(nproc, len(tasklist),
                     worker_init=checkstatus_init, worker_end=checkstatus_end)
             for t in tasklist:
                 pool.add_task(checkstatus, t)
             pool.start()
             pool.wait_completion()
+            bb.event.disable_threadlock()
+
             bb.event.fire(bb.event.ProcessFinished("Checking sstate mirror object availability"), d)
             if whitelist and missing:
                 bb.fatal('Required artifacts were unavailable - exiting')