Skip to contentSkip to conversation

oeqa/sstatetests: Fix race issue

PATCH New Richard Purdie 1 participant 1 message Mar 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/sstatetests: Fix race issue

Under some load conditions, the result event can come back before the command complete event. If that happens, the code would hang indefinitely.

Rework the code to wait for both events and avoid the hang.

---
 meta/lib/oeqa/selftest/cases/sstatetests.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/cases/sstatetests.py +3 -2
index e2f509c3e83..86d6cd7464f 100644
@@ -772,15 +772,16 @@ addtask tmptask2 before do_tmptask1
 
             def find_siginfo(pn, taskname, sigs=None):
                 result = None
+                command_complete = False
                 tinfoil.set_event_mask(["bb.event.FindSigInfoResult",
                                 "bb.command.CommandCompleted"])
                 ret = tinfoil.run_command("findSigInfo", pn, taskname, sigs)
                 if ret:
-                    while True:
+                    while result is None or not command_complete:
                         event = tinfoil.wait_event(1)
                         if event:
                             if isinstance(event, bb.command.CommandCompleted):
-                                break
+                                command_complete = True
                             elif isinstance(event, bb.event.FindSigInfoResult):
                                 result = event.result
                 return result
Signature · 1 line
2.40.1