runqueue: Ensure deferred tasks are sorted by multiconfig
PATCH 1/3 runqueue: Ensure deferred tasks are sorted by multiconfig
We have to prefer one multiconfig over another when deferring tasks, else we'll have cross-linked build trees and nothing will be able to build.
In the original population code, we sort like this but we don't after rehashing. Ensure we have the same sorting after rehashing toa void deadlocks.
--- lib/bb/runqueue.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
lib/bb/runqueue.py +8 -5
@@ -2506,11 +2506,14 @@ class RunQueueExecute: if update_tasks: self.sqdone = False - for tid in [t[0] for t in update_tasks]: - h = pending_hash_index(tid, self.rqdata) - if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]: - self.sq_deferred[tid] = self.sqdata.hashes[h] - bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h])) + for mc in sorted(sqdata.multiconfigs): + for tid in sorted([t[0] for t in update_tasks]): + if mc_from_tid(tid) != mc: + continue + h = pending_hash_index(tid, self.rqdata) + if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]: + self.sq_deferred[tid] = self.sqdata.hashes[h] + bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h])) update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False) for (tid, harddepfail, origvalid) in update_tasks:
Signature · 1 line
2.34.1
PATCH 2/3 runqueue: Improve deadlock warning messages
Tweak the deadlock breaking messages to be explict about which task is blocked on which other task. The messages currently imply it is "freeing" the blocking task which is confusing.
--- lib/bb/runqueue.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
lib/bb/runqueue.py +6 -4
@@ -2237,10 +2237,12 @@ class RunQueueExecute: # No more tasks can be run. If we have deferred setscene tasks we should run them. if self.sq_deferred: - tid = self.sq_deferred.pop(list(self.sq_deferred.keys())[0]) - logger.warning("Runqeueue deadlocked on deferred tasks, forcing task %s" % tid) - if tid not in self.runq_complete: - self.sq_task_failoutright(tid) + deferred_tid = list(self.sq_deferred.keys())[0] + blocking_tid = self.sq_deferred.pop(deferred_tid) + logger.warning("Runqeueue deadlocked on deferred tasks, forcing task %s blocked by %s" % (deferred_tid, blocking_tid)) + if blocking_tid not in self.runq_complete: + logger.warning("Failing blocking task %s" % (blocking_tid)) + self.sq_task_failoutright(blocking_tid) return True if self.failed_tids:
Signature · 1 line
2.34.1
PATCH 3/3 runqueue: Drop deadlock breaking force fail
In reply to Richard PurdieI'm 99% certain this failing of a scenequeue task corrupts runqueue and causes all kinds of breakage. I'd rather runqueue deadlocked than corrupted and did weird things so drop this code.
We've seen builds where the deadlock triggers and it then tries to run tasks where the SQ task already ran with very confusing failures. It is likely it is this code causing it.
--- lib/bb/runqueue.py | 3 --- 1 file changed, 3 deletions(-)
lib/bb/runqueue.py +0 -3
@@ -2240,9 +2240,6 @@ class RunQueueExecute: deferred_tid = list(self.sq_deferred.keys())[0] blocking_tid = self.sq_deferred.pop(deferred_tid) logger.warning("Runqeueue deadlocked on deferred tasks, forcing task %s blocked by %s" % (deferred_tid, blocking_tid)) - if blocking_tid not in self.runq_complete: - logger.warning("Failing blocking task %s" % (blocking_tid)) - self.sq_task_failoutright(blocking_tid) return True if self.failed_tids:
Signature · 1 line
2.34.1