[2/2] toaster: race condition for end-of-build

Message ID e01517623fbed0d9e9f3b59acf0f0d9aaea38107.1647836508.git.David.Reyna@windriver.com
State Accepted, archived
Commit f76c13536e19d2401365c0fc240ef8dbcb3ee7e8
Headers show
Series [1/2] toaster: detect when bitbake crashed | expand

Commit Message

Reyna, David March 21, 2022, 5:02 a.m. UTC
From: David Reyna <David.Reyna@windriver.com>

Force a sync point for end-of build event handler force
the build's outcome status commit, to resolve a race
condition with the build completion takedown.

[YOCTO #14765]

Signed-off-by: David Reyna <David.Reyna@windriver.com>
---
 lib/bb/ui/buildinfohelper.py | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 8fef663469..0761f73b3b 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -227,6 +227,12 @@  class ORMWrapper(object):
         build.completed_on = timezone.now()
         build.outcome = outcome
         build.save()
+
+        # We force a sync point here to force the outcome status commit,
+        # which resolves a race condition with the build completion takedown
+        transaction.set_autocommit(True)
+        transaction.set_autocommit(False)
+
         signal_runbuilds()
 
     def update_target_set_license_manifest(self, target, license_manifest_path):