Skip to contentSkip to conversation

runqueue: Fix issues with multiconfig deferred task deadlock messages

PATCH Superseded Richard Purdie 1 participant 2 messages Sep 7, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 runqueue: Fix issues with multiconfig deferred task deadlock messages

In multiconfig builds with large numbers of identical tasks, builds were deadlocking after recent runqueue changes upon rebuilds where there was heavy sstate usage (i.e. on second builds after a first completed).

The issue was that deferred tasks were being left indefinitely on the deferred list. The deadlock handler was then "breaking" things by failing tasks that had already succeeded, leading to the task being on both covered and not covered lists, giving a further error.

The fix is to clean up the deferred task list when each setscene task completes. I'd previously been hoping to avoid iterating that list but it appears unavoidable.

[YOCTO #14342]

---
 lib/bb/runqueue.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/runqueue.py +5 -0
index 25e012125c..c652f3eaf7 100644
@@ -2492,6 +2492,11 @@ class RunQueueExecute:
 
         self.holdoff_need_update = True
 
+        for t in self.sq_deferred.copy():
+            if self.sq_deferred[t] == task:
+                logger.debug2("Deferred task %s now buildable" % t)
+                del self.sq_deferred[t]
+
     def sq_task_completeoutright(self, task):
         """
         Mark a task as completed
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/2 runqueue: Avoid deadlock avoidance task graph corruption

If the deferred task deadlock avoidance code triggers, it could mark an executed task as failed which leads to "covered and not covered" error messages. Improve the logic so if the deadlock code is triggered, it doesn't cause the errors.

---
 lib/bb/runqueue.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/bb/runqueue.py +2 -1
index c652f3eaf7..05ca5c4e88 100644
@@ -2180,7 +2180,8 @@ class RunQueueExecute:
         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)
-            self.sq_task_failoutright(tid)
+            if tid not in self.runq_complete:
+                self.sq_task_failoutright(tid)
             return True
 
         if len(self.failed_tids) != 0:
Signature · 1 line
2.32.0