runqueue: Fix equiv hash handling build failures
PATCH 1/5 runqueue: Fix equiv hash handling build failures
Regardless of whether we remapped the hash on the server or not, we need to have bitbake work as if we did as we need to match how the stamp files look.
This change resolves build failures where tasks were rerunning when they shouldn't.
--- lib/bb/runqueue.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/bb/runqueue.py +2 -1
@@ -2302,8 +2302,9 @@ class RunQueueExecute: remapped = True elif tid in self.scenequeue_covered or tid in self.sq_live: # Already ran this setscene task or it running. Report the new taskhash - remapped = bb.parse.siggen.report_unihash_equiv(tid, newhash, origuni, newuni, self.rqdata.dataCaches) + bb.parse.siggen.report_unihash_equiv(tid, newhash, origuni, newuni, self.rqdata.dataCaches) logger.info("Already covered setscene for %s so ignoring rehash (remap)" % (tid)) + remapped = True if not remapped: #logger.debug(1, "Task %s hash changes: %s->%s %s->%s" % (tid, orighash, newhash, origuni, newuni))
Signature · 1 line
2.20.1
PATCH 2/5 runqueue: Ensure task dependencies are run correctly
We've seen a number of mystery failures where task B would run despite task A, its dependency not having run. An example would be do_compile when do_unpack didn't run.
This has been tracked down to this code block. In theory it shouldn't trigger however it can and has due to bugs elsewhere. When it does, it causes significant weird failures and possible build corruption.
Change the code to abort the build. This avoids any chance of corruption and should ensure the issues get reported, putting an end to the weird build failures.
There may be some cases where this triggers and it shouldn't, we'll work through those as they arise and are identified.
--- lib/bb/runqueue.py | 6 ++++++ 1 file changed, 6 insertions(+)
lib/bb/runqueue.py +6 -0
@@ -2353,6 +2353,12 @@ class RunQueueExecute: if tid in self.tasks_scenequeue_done: self.tasks_scenequeue_done.remove(tid) for dep in self.sqdata.sq_covered_tasks[tid]: + if dep in self.runq_complete: + bb.error("Task %s marked as completed but now needing to rerun? Aborting build." % dep) + self.failed_tids.append(tid) + self.rq.state = runQueueCleanUp + return + if dep not in self.runq_complete: if dep in self.tasks_scenequeue_done and dep not in self.sqdata.unskippable: self.tasks_scenequeue_done.remove(dep)
Signature · 1 line
2.20.1
PATCH 3/5 runqueue: Fix task dependency corner case in sanity test
In reply to Richard PurdieA corner case was identified where tasks with valid stamps from previous builds need to be accounted for in the new sanity test in the migration code. Add a variable to track such completed tasks to ensure the sanity test works correctly.
--- lib/bb/runqueue.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/bb/runqueue.py +4 -1
@@ -1708,6 +1708,7 @@ class RunQueueExecute: self.runq_buildable = set() self.runq_running = set() self.runq_complete = set() + self.runq_tasksrun = set() self.build_stamps = {} self.build_stamps2 = []
@@ -1893,6 +1894,7 @@ class RunQueueExecute: self.stats.taskCompleted() bb.event.fire(runQueueTaskCompleted(task, self.stats, self.rq), self.cfgData) self.task_completeoutright(task) + self.runq_tasksrun.add(task) def task_fail(self, task, exitcode): """
@@ -2092,6 +2094,7 @@ class RunQueueExecute: logger.debug(2, "Stamp current task %s", task) self.task_skip(task, "existing") + self.runq_tasksrun.add(task) return True taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn]
@@ -2353,7 +2356,7 @@ class RunQueueExecute: if tid in self.tasks_scenequeue_done: self.tasks_scenequeue_done.remove(tid) for dep in self.sqdata.sq_covered_tasks[tid]: - if dep in self.runq_complete: + if dep in self.runq_complete and dep not in self.runq_tasksrun: bb.error("Task %s marked as completed but now needing to rerun? Aborting build." % dep) self.failed_tids.append(tid) self.rq.state = runQueueCleanUp
Signature · 1 line
2.20.1
PATCH 4/5 siggen: Test extra cross/native hashserv method
In reply to Richard PurdieHack the hashserv to allow extra data to be injected into the hashserv method. This allows OE-Core to handle cases where there are multiple sstate objects for the same taskhash, e.g. native/cross objects based upon BUILD_ARCH or the host distro (when uninative isn't used).
This has been tested and proven to be very effective. We will likely rework the code to improve how this is handled but for now this improves automated builds until we can get to that refactoring and more invasive changes.
--- lib/bb/siggen.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
lib/bb/siggen.py +21 -6
@@ -391,12 +391,16 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): bb.build.write_taint(task, d, fn) class SignatureGeneratorUniHashMixIn(object): + def __init__(self, data): + self.extramethod = {} + super().__init__(data) + def get_taskdata(self): - return (self.server, self.method) + super().get_taskdata() + return (self.server, self.method, self.extramethod) + super().get_taskdata() def set_taskdata(self, data): - self.server, self.method = data[:2] - super().set_taskdata(data[2:]) + self.server, self.method, self.extramethod = data[:3] + super().set_taskdata(data[3:]) def client(self): if getattr(self, '_client', None) is None:
@@ -453,7 +457,10 @@ class SignatureGeneratorUniHashMixIn(object): unihash = taskhash try: - data = self.client().get_unihash(self.method, self.taskhash[tid]) + method = self.method + if tid in self.extramethod: + method = method + self.extramethod[tid] + data = self.client().get_unihash(method, self.taskhash[tid]) if data: unihash = data # A unique hash equal to the taskhash is not very interesting,
@@ -522,7 +529,11 @@ class SignatureGeneratorUniHashMixIn(object): extra_data['task'] = task extra_data['outhash_siginfo'] = sigfile.read().decode('utf-8') - data = self.client().report_unihash(taskhash, self.method, outhash, unihash, extra_data) + method = self.method + if tid in self.extramethod: + method = method + self.extramethod[tid] + + data = self.client().report_unihash(taskhash, method, outhash, unihash, extra_data) new_unihash = data['unihash'] if new_unihash != unihash:
@@ -549,7 +560,11 @@ class SignatureGeneratorUniHashMixIn(object): def report_unihash_equiv(self, tid, taskhash, wanted_unihash, current_unihash, datacaches): try: extra_data = {} - data = self.client().report_unihash_equiv(taskhash, self.method, wanted_unihash, extra_data) + method = self.method + if tid in self.extramethod: + method = method + self.extramethod[tid] + + data = self.client().report_unihash_equiv(taskhash, method, wanted_unihash, extra_data) bb.note('Reported task %s as unihash %s to %s (%s)' % (tid, wanted_unihash, self.server, str(data))) if data is None:
Signature · 1 line
2.20.1
PATCH 5/5 cache: Lower debug level for wold build messages
In reply to Richard PurdieThese messages spam the logs for no good reason, they were useful for debugging a particular problem long ago but are distracting noise now. Disable them.
--- lib/bb/cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/bb/cache.py +3 -3
@@ -208,10 +208,10 @@ class CoreRecipeInfo(RecipeInfoCommon): # Collect files we may need for possible world-dep # calculations - if self.not_world: - logger.debug(1, "EXCLUDE FROM WORLD: %s", fn) - else: + if not self.not_world: cachedata.possible_world.append(fn) + #else: + # logger.debug(2, "EXCLUDE FROM WORLD: %s", fn) # create a collection of all targets for sanity checking # tasks, such as upstream versions, license, and tools for
Signature · 1 line
2.20.1