Skip to contentSkip to conversation

selftest/reproducible: Don't call sync between each file compare

PATCH In review Richard Purdie 2 participants 5 messages Feb 26, 2021 – Mar 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftest/reproducible: Don't call sync between each file compare

Calling sync between each file compare is horrible performance wise as we compare thousands of files. We don't care about IO latency here so disable.

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +1 -1
index ce4e8ebe06b..05fc4b7fa0a 100644
@@ -123,7 +123,7 @@ def compare_file(reference, test, diffutils_sysroot):
         result.status = MISSING
         return result
 
-    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True)
+    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True, sync=False)
 
     if r.status:
         result.status = DIFFERENT
Signature · 1 line
2.27.0
#1 lore raw

Hi,

Quoted 14 lines · Richard Purdie

Calling sync between each file compare is horrible performance wise as we compare thousands of files. We don't care about IO latency here so disable.

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -0
index ce4e8ebe06b..05fc4b7fa0a 100644

meta/lib/oeqa/selftest/cases/reproducible.py def compare_file(reference, test, diffutils_sysroot): · line 126

Quoted 5 lines
meta/lib/oeqa/selftest/cases/reproducible.py +1 -1
@@ -123,7 +123,7 @@ def compare_file(reference, test, diffutils_sysroot):
         result.status = MISSING
         return result
 
-    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True)
+    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True, sync=False)

Uh, sync is horrible for performance. Why don't we change it to false by default:

meta/lib/oeqa/utils/commands.py +1 -1
@@ -167,7 +167,7 @@ class Result(object):
     pass
 
 
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True,
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=False,
           native_sysroot=None, limit_exc_output=0, output_log=None, **options):
     result = Result()
 

Based on comment:

    # tests can be heavy on IO and if bitbake can't write out its caches, we see timeouts.
    # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO
    # hit here rather than in bitbake shutdown.
    if sync:
        p = os.environ['PATH']
        os.environ['PATH'] = "/usr/bin:/bin:/usr/sbin:/sbin:" + p
        os.system("sync")
        os.environ['PATH'] = p

this looks like a workaround for some other bug.

Cheers,

-Mikko

Quoted 9 lines
meta/lib/oeqa/selftest/cases/reproducible.py +0 -0
     if r.status:
         result.status = DIFFERENT
Signature · 1 line
2.27.0
#2 lore raw
Quoted 53 lines · On Mon, 2021-03-01 at 07:59 +0000, [email protected] wrote:

Hi,

Quoted 18 lines · Richard Purdie

Calling sync between each file compare is horrible performance wise as we compare thousands of files. We don't care about IO latency here so disable.

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -0
index ce4e8ebe06b..05fc4b7fa0a 100644
@@ -123,7 +123,7 @@ def compare_file(reference, test, diffutils_sysroot):

         result.status = MISSING
         return result

meta/lib/oeqa/selftest/cases/reproducible.py

Quoted 2 lines
meta/lib/oeqa/selftest/cases/reproducible.py +1 -1
-    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True)
+    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True, sync=False)

Uh, sync is horrible for performance. Why don't we change it to false by default:

meta/lib/oeqa/utils/commands.py +0 -0
@@ -167,7 +167,7 @@ class Result(object):

     pass

meta/lib/oeqa/utils/commands.py +1 -1
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True,
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=False,

           native_sysroot=None, limit_exc_output=0, output_log=None, **options):
     result = Result()

Based on comment:

    # tests can be heavy on IO and if bitbake can't write out its caches, we see timeouts.
    # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO
    # hit here rather than in bitbake shutdown.
    if sync:
        p = os.environ['PATH']
        os.environ['PATH'] = "/usr/bin:/bin:/usr/sbin:/sbin:" + p
        os.system("sync")
        os.environ['PATH'] = p
Quoted 1 line

this looks like a workaround for some other bug.

The wider issue is the randomly failing ptests and other issues with the automated testing, particularly things running under qemu system mode. Those seemed partly to be caused by huge IO queues building up. The idea of the sync calls was to keep the UI backlog manageable.

In most cases we execute occasional commands so this should work/help. In the case of the reproducible ptest, we execute a cmp on every generated package which really didn't work well hence it makes sense to disable it there.

We don't see this issue with any other tests as far as I've observed. I really don't want to make the runtime testing results worse, anyone who's looked at swat or attended bug triage will know how much trouble we're having with the issues this code helps mitigate :/.

Cheers,

Richard

#3 lore raw
Quoted 61 lines · Richard Purdie
Quoted 53 lines · On Mon, 2021-03-01 at 07:59 +0000, [email protected] wrote:

Hi,

Quoted 18 lines · Richard Purdie

Calling sync between each file compare is horrible performance wise as we compare thousands of files. We don't care about IO latency here so disable.

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -0
index ce4e8ebe06b..05fc4b7fa0a 100644
@@ -123,7 +123,7 @@ def compare_file(reference, test, diffutils_sysroot):

         result.status = MISSING
         return result

meta/lib/oeqa/selftest/cases/reproducible.py

Quoted 2 lines
meta/lib/oeqa/selftest/cases/reproducible.py +1 -1
-    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True)
+    r = runCmd(['cmp', '--quiet', reference, test], native_sysroot=diffutils_sysroot, ignore_status=True, sync=False)

Uh, sync is horrible for performance. Why don't we change it to false by default:

meta/lib/oeqa/utils/commands.py +0 -0
@@ -167,7 +167,7 @@ class Result(object):

     pass

meta/lib/oeqa/utils/commands.py +1 -1
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=True,
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=False,

           native_sysroot=None, limit_exc_output=0, output_log=None, **options):
     result = Result()

Based on comment:

    # tests can be heavy on IO and if bitbake can't write out its caches, we see timeouts.
    # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO
    # hit here rather than in bitbake shutdown.
    if sync:
        p = os.environ['PATH']
        os.environ['PATH'] = "/usr/bin:/bin:/usr/sbin:/sbin:" + p
        os.system("sync")
        os.environ['PATH'] = p
Quoted 1 line

this looks like a workaround for some other bug.

The wider issue is the randomly failing ptests and other issues with the automated testing, particularly things running under qemu system mode. Those seemed partly to be caused by huge IO queues building up. The idea of the sync calls was to keep the UI backlog manageable.

Quoted 8 lines

In most cases we execute occasional commands so this should work/help. In the case of the reproducible ptest, we execute a cmp on every generated package which really didn't work well hence it makes sense to disable it there.

We don't see this issue with any other tests as far as I've observed. I really don't want to make the runtime testing results worse, anyone who's looked at swat or attended bug triage will know how much trouble we're having with the issues this code helps mitigate :/.

Ok, understood. You need to keep the system and tests running.

But IO flushes can take any amount of time. So sounds like timeouts are too short, or should not exists at all. Also, systems are doing too much parallel work or are actually short on RAM if slow IO to disk starts failing things.

-Mikko

#4 lore raw
Quoted 32 lines · On Mon, 2021-03-01 at 08:43 +0000, [email protected] wrote:
Quoted 22 lines · Richard Purdie
Quoted 14 lines · On Mon, 2021-03-01 at 07:59 +0000, [email protected] wrote:

On Fri, Feb 26, 2021 at 05:47:52PM +0000, Richard Purdie wrote:

Based on comment:

    # tests can be heavy on IO and if bitbake can't write out its caches, we see timeouts.
    # call sync around the tests to ensure the IO queue doesn't get too large, taking any IO
    # hit here rather than in bitbake shutdown.
    if sync:
        p = os.environ['PATH']
        os.environ['PATH'] = "/usr/bin:/bin:/usr/sbin:/sbin:" + p
        os.system("sync")
        os.environ['PATH'] = p
Quoted 1 line

this looks like a workaround for some other bug.

The wider issue is the randomly failing ptests and other issues with the automated testing, particularly things running under qemu system mode. Those seemed partly to be caused by huge IO queues building up. The idea of the sync calls was to keep the UI backlog manageable.

Quoted 8 lines

In most cases we execute occasional commands so this should work/help. In the case of the reproducible ptest, we execute a cmp on every generated package which really didn't work well hence it makes sense to disable it there.

We don't see this issue with any other tests as far as I've observed. I really don't want to make the runtime testing results worse, anyone who's looked at swat or attended bug triage will know how much trouble we're having with the issues this code helps mitigate :/.

Quoted 6 lines

Ok, understood. You need to keep the system and tests running.

But IO flushes can take any amount of time. So sounds like timeouts are too short, or should not exists at all. Also, systems are doing too much parallel work or are actually short on RAM if slow IO to disk starts failing things.

I'm far from happy with where we're at with the autobuilder intermittent failures. Along with the bug triage team, I've spent the best part of a couple of years trying to get to grips with them. The sync work around does help to a degree and that is in itself helpful and reduces the load on build failure handling.

We do already have a ton of memory in the workers. We're reluctant to reduce the parallelism numbers as in general things work well, we 'just' see a single failure in every other build (where the builds report 2 million test results over 4 arches each in 32+64 bit, different init systems and so on).

The "timeouts" are things like kernel rcu failures in guests, bitbake event test issues (where a 5s timeout increased to over 60s doesn't help). Another example is valgrind's ptests. Where possible we're trying to rewrite not to have the timeouts.

I'd love some help in getting to the bottom of the issues but we have already tried the simpler stuff sadly :(. The issues are very very rare but annoying when they do happen.

Cheers,

Richard