Skip to contentSkip to conversation

oeqa/runtime: fix race-condition in minidebuginfo test

PATCH Superseded [email protected] 2 participants 3 messages Jun 10, 2024

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oeqa/runtime: fix race-condition in minidebuginfo test

From: Etienne Cordonnier <[email protected]>

Fix this error where 'coredumpctl info' warns that the coredump is still being processed:

```
AssertionError: 1 != 0 : MiniDebugInfo Test failed: No match found.
-- Notice: 1 [email protected] unit is running, output may be incomplete.
```
---
 meta/lib/oeqa/runtime/cases/systemd.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oeqa/runtime/cases/systemd.py +3 -0
index 80fdae240a..17fa660ace 100644
@@ -155,6 +155,9 @@ class SystemdServiceTests(SystemdTest):
         self.target.run('kill -SEGV %s' % output)
         self.assertEqual(status, 0, msg = 'Not able to find process that runs sleep, output : %s' % output)
 
+        # Give some time to [email protected] to process the coredump
+        time.sleep(1)
+
         (status, output) = self.target.run('coredumpctl info')
         self.assertEqual(status, 0, msg='MiniDebugInfo Test failed: %s' % output)
         self.assertEqual('sleep_for_duration (busybox.nosuid' in output or 'xnanosleep (sleep.coreutils' in output,
Signature · 1 line
2.36.1.vfs.0.0
#1 lore raw
Quoted 22 lines · Etienne Cordonnier via lists.openembedded.org

From: Etienne Cordonnier <[email protected]>

Fix this error where 'coredumpctl info' warns that the coredump is still being processed:

```
AssertionError: 1 != 0 : MiniDebugInfo Test failed: No match found.
-- Notice: 1 [email protected] unit is running, output may be incomplete.
```

---
 meta/lib/oeqa/runtime/cases/systemd.py | 3 +++

 1 file changed, 3 insertions(+)
meta/lib/oeqa/runtime/cases/systemd.py +0 -0
index 80fdae240a..17fa660ace 100644
@@ -155,6 +155,9 @@ class SystemdServiceTests(SystemdTest):
          self.target.run('kill -SEGV %s' % output)
          self.assertEqual(status, 0, msg = 'Not able to find process that runs sleep, output : %s' % output)
Quoted 8 lines


+        # Give some time to [email protected] to process the coredump
+        time.sleep(1)
+
         (status, output) = self.target.run('coredumpctl info')
         self.assertEqual(status, 0, msg='MiniDebugInfo Test failed: %s' % output) self.assertEqual('sleep_for_duration (busybox.nosuid' in output or 'xnanosleep (sleep.coreutils' in output,

Specific sleep values like this are a red flag, it all depends on how much load systems are under and we've had a lot of problems with these kinds of things.

Instead, you should probably detect "[email protected] unit is running" in the command output and retry if that is the case with an overall timeout/error in case it never completes.

Cheers,

Richard

#2 lore raw

Hi Richard,
I sent a second version of the patch which shouldn't be racy. I have implemented it slightly differently from your suggestion because I think it is also a bit racy (if we start checking whether [email protected] is running in one thread only after it has already finished processing the coredump in the other thread, then we'll be stuck in a retry loop until the overall timeout).

Étienne

Quoted 52 lines · Richard Purdie
Quoted 3 lines · Etienne Cordonnier via lists.openembedded.org

From: Etienne Cordonnier <[email protected]>

Fix this error where 'coredumpctl info' warns that the coredump is still

being

Quoted 5 lines

processed:

```
AssertionError: 1 != 0 : MiniDebugInfo Test failed: No match found. -- Notice: 1 [email protected] unit is running, output may be

incomplete.

Review

Quoted 8 lines

```

---
 meta/lib/oeqa/runtime/cases/systemd.py | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/meta/lib/oeqa/runtime/cases/systemd.py

meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 156

Quoted 6 lines

index 80fdae240a..17fa660ace 100644

meta/lib/oeqa/runtime/cases/systemd.py +0 -0
@@ -155,6 +155,9 @@ class SystemdServiceTests(SystemdTest):
         self.target.run('kill -SEGV %s' % output)
         self.assertEqual(status, 0, msg = 'Not able to find process

that runs sleep, output : %s' % output)

meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 157

Quoted 2 lines
meta/lib/oeqa/runtime/cases/systemd.py +1 -0
+        # Give some time to [email protected] to process the

coredump

meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest):

Quoted 4 lines
meta/lib/oeqa/runtime/cases/systemd.py +2 -0
+        time.sleep(1)
+
         (status, output) = self.target.run('coredumpctl info')
         self.assertEqual(status, 0, msg='MiniDebugInfo Test failed: %s'

% output)

meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 162

Quoted 1 line
meta/lib/oeqa/runtime/cases/systemd.py +0 -0
         self.assertEqual('sleep_for_duration (busybox.nosuid' in output

or 'xnanosleep (sleep.coreutils' in output,

Quoted 1 line

Specific sleep values like this are a red flag, it all depends on how much load systems are under and we've had a lot of problems with these kinds of things.

Instead, you should probably detect "[email protected] unit is running" in the command output and retry if that is the case with an overall timeout/error in case it never completes.

Cheers,

Richard