All of lore.kernel.org
 help / color / mirror / Atom feed
* [bitbake][dunfell][1.46][PATCH 0/5] Patch review
@ 2022-06-21 18:20 Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 1/5] server/process: Disable gc around critical section Steve Sakoman
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:20 UTC (permalink / raw)
  To: bitbake-devel

Please review this set of patches for 1.46/dunfell and have comments back by
end of day Thursday/

Passed a-full on autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/3805

The following changes since commit d8c2175f6a7b5fdf111d6a073b2c3dbd3c0b061d:

  fetch2: add check for empty SRC_URI hash string (2022-04-05 20:49:37 +0100)

are available in the Git repository at:

  git://git.openembedded.org/bitbake-contrib stable/1.46-nut
  http://cgit.openembedded.org/bitbake-contrib/log/?h=stable/1.46-nut

Richard Purdie (3):
  server/process: Disable gc around critical section
  tinfoil/data_smart: Allow variable history emit() to function remotely
  bin/bitbake-getvar: Add a new command to query a variable value (with
    history)

Ross Burton (2):
  knotty: display active tasks when printing keepAlive() message
  knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10
    minutes

 bin/bitbake-getvar       | 48 ++++++++++++++++++++++++++++++++++++++++
 lib/bb/command.py        | 12 ++++++++++
 lib/bb/server/process.py |  3 +++
 lib/bb/tinfoil.py        |  4 ++++
 lib/bb/ui/knotty.py      | 11 +++++----
 5 files changed, 74 insertions(+), 4 deletions(-)
 create mode 100755 bin/bitbake-getvar

-- 
2.25.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bitbake][dunfell][1.46][PATCH 1/5] server/process: Disable gc around critical section
  2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
@ 2022-06-21 18:20 ` Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 2/5] tinfoil/data_smart: Allow variable history emit() to function remotely Steve Sakoman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:20 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

The python gc can trigger whilst we're holding the event stream lock
and when cleaning up objects, they can trigger warnings. This translates
into a new event which would then need the lock and we can deadlock.

Disable gc whilst we hold that lock to avoid this unfortunate and
problematic situation.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 96a6303949cefd469bcf5ed250ff512271354357)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/server/process.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 3c9ed706..4bdb84ae 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -25,6 +25,7 @@ import subprocess
 import errno
 import re
 import datetime
+import gc
 import bb.server.xmlrpcserver
 from bb import daemonize
 from multiprocessing import queues
@@ -671,8 +672,10 @@ class ConnectionWriter(object):
 
     def send(self, obj):
         obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
+        gc.disable()
         with self.wlock:
             self.writer.send_bytes(obj)
+        gc.enable()
 
     def fileno(self):
         return self.writer.fileno()
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bitbake][dunfell][1.46][PATCH 2/5] tinfoil/data_smart: Allow variable history emit() to function remotely
  2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 1/5] server/process: Disable gc around critical section Steve Sakoman
@ 2022-06-21 18:20 ` Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 3/5] bin/bitbake-getvar: Add a new command to query a variable value (with history) Steve Sakoman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:20 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

We can't access the emit() function of varhistory currently as the datastore parameter
isn't handled correctly, nor is the output stream. Add a custom wrapper for this
function which handles the two details correctly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit ba0fa084ccd2b1ade96425d158fd31e49e42f286)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/command.py | 12 ++++++++++++
 lib/bb/tinfoil.py |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 98c945ed..b8429b27 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -20,6 +20,7 @@ Commands are queued in a CommandQueue
 
 from collections import OrderedDict, defaultdict
 
+import io
 import bb.event
 import bb.cooker
 import bb.remotedata
@@ -478,6 +479,17 @@ class CommandsSync:
         d = command.remotedatastores[dsindex].varhistory
         return getattr(d, method)(*args, **kwargs)
 
+    def dataStoreConnectorVarHistCmdEmit(self, command, params):
+        dsindex = params[0]
+        var = params[1]
+        oval = params[2]
+        val = params[3]
+        d = command.remotedatastores[params[4]]
+
+        o = io.StringIO()
+        command.remotedatastores[dsindex].varhistory.emit(var, oval, val, o, d)
+        return o.getvalue()
+
     def dataStoreConnectorIncHistCmd(self, command, params):
         dsindex = params[0]
         method = params[1]
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 28f1e562..8bec8cba 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -53,6 +53,10 @@ class TinfoilDataStoreConnectorVarHistory:
     def remoteCommand(self, cmd, *args, **kwargs):
         return self.tinfoil.run_command('dataStoreConnectorVarHistCmd', self.dsindex, cmd, args, kwargs)
 
+    def emit(self, var, oval, val, o, d):
+        ret = self.tinfoil.run_command('dataStoreConnectorVarHistCmdEmit', self.dsindex, var, oval, val, d.dsindex)
+        o.write(ret)
+
     def __getattr__(self, name):
         if not hasattr(bb.data_smart.VariableHistory, name):
             raise AttributeError("VariableHistory has no such method %s" % name)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bitbake][dunfell][1.46][PATCH 3/5] bin/bitbake-getvar: Add a new command to query a variable value (with history)
  2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 1/5] server/process: Disable gc around critical section Steve Sakoman
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 2/5] tinfoil/data_smart: Allow variable history emit() to function remotely Steve Sakoman
@ 2022-06-21 18:20 ` Steve Sakoman
  2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 4/5] knotty: display active tasks when printing keepAlive() message Steve Sakoman
  2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 5/5] knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes Steve Sakoman
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:20 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

We've talked about having this for long enough. Add a command which queries a single
variable value with history. This saves "bitbake -e | grep" and avoids the
various pitfalls that has.

It also provides a neat example of using tinfoil to make such a query.

Parameters to limit the output to just the value, to limit to a variable flag
and to not expand the output are provided.

[YOCTO #10748]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4c1881b620e885f55d7772f8626b8a76c2828333)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 bin/bitbake-getvar | 48 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100755 bin/bitbake-getvar

diff --git a/bin/bitbake-getvar b/bin/bitbake-getvar
new file mode 100755
index 00000000..94232192
--- /dev/null
+++ b/bin/bitbake-getvar
@@ -0,0 +1,48 @@
+#! /usr/bin/env python3
+#
+# Copyright (C) 2021 Richard Purdie
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+import argparse
+import io
+import os
+import sys
+
+bindir = os.path.dirname(__file__)
+topdir = os.path.dirname(bindir)
+sys.path[0:0] = [os.path.join(topdir, 'lib')]
+
+import bb.tinfoil
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description="Bitbake Query Variable")
+    parser.add_argument("variable", help="variable name to query")
+    parser.add_argument("-r", "--recipe", help="Recipe name to query", default=None, required=False)
+    parser.add_argument('-u', '--unexpand', help='Do not expand the value (with --value)', action="store_true")
+    parser.add_argument('-f', '--flag', help='Specify a variable flag to query (with --value)', default=None)
+    parser.add_argument('--value', help='Only report the value, no history and no variable name', action="store_true")
+    args = parser.parse_args()
+
+    if args.unexpand and not args.value:
+        print("--unexpand only makes sense with --value")
+        sys.exit(1)
+
+    if args.flag and not args.value:
+        print("--flag only makes sense with --value")
+        sys.exit(1)
+
+    with bb.tinfoil.Tinfoil(tracking=True) as tinfoil:
+        if args.recipe:
+            tinfoil.prepare(quiet=2)
+            d = tinfoil.parse_recipe(args.recipe)
+        else:
+            tinfoil.prepare(quiet=2, config_only=True)
+            d = tinfoil.config_data
+        if args.flag:
+            print(str(d.getVarFlag(args.variable, args.flag, expand=(not args.unexpand))))
+        elif args.value:
+            print(str(d.getVar(args.variable, expand=(not args.unexpand))))
+        else:
+            bb.data.emit_var(args.variable, d=d, all=True)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bitbake][dunfell][1.46][PATCH 4/5] knotty: display active tasks when printing keepAlive() message
  2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
                   ` (2 preceding siblings ...)
  2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 3/5] bin/bitbake-getvar: Add a new command to query a variable value (with history) Steve Sakoman
@ 2022-06-21 18:21 ` Steve Sakoman
  2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 5/5] knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes Steve Sakoman
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:21 UTC (permalink / raw)
  To: bitbake-devel

From: Ross Burton <ross@burtonini.com>

In interactive bitbake sessions it is obvious what tasks are running
when one of them hangs or otherwise takes a long time. However, in
non-interactive sessions (such as automated builds) bitbake just prints
a message saying that it is "still alive" with no clues as to what tasks
are active still.

By simply listing the active tasks when printing the keep alive message,
we don't need to parse the bitbake log to identify which of the tasks
is still active and has presumably hung.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 30f6c3f175617beea8e8bb75dcf255611e3fc2fd)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/ui/knotty.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index e70c2464..71c5a3e9 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -227,7 +227,9 @@ class TerminalFilter(object):
 
     def keepAlive(self, t):
         if not self.cuu:
-            print("Bitbake still alive (%ds)" % t)
+            print("Bitbake still alive (no events for %ds). Active tasks:" % t)
+            for t in self.helper.running_tasks:
+                print(t)
             sys.stdout.flush()
 
     def updateFooter(self):
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bitbake][dunfell][1.46][PATCH 5/5] knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes
  2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
                   ` (3 preceding siblings ...)
  2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 4/5] knotty: display active tasks when printing keepAlive() message Steve Sakoman
@ 2022-06-21 18:21 ` Steve Sakoman
  4 siblings, 0 replies; 6+ messages in thread
From: Steve Sakoman @ 2022-06-21 18:21 UTC (permalink / raw)
  To: bitbake-devel

From: Ross Burton <ross@burtonini.com>

The keep alive timeout is excessively long at 83 minutes (5000 seconds),
reduce this to 10 minutes: this should be long enough that it rarely
triggers in normal builds, but when it does it has useful information.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit dcf52157d3635925491783be656c6b76d1efe1a4)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/ui/knotty.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 71c5a3e9..d1f74389 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -599,7 +599,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
     warnings = 0
     taskfailures = []
 
-    printinterval = 5000
+    printintervaldelta = 10 * 60 # 10 minutes
+    printinterval = printintervaldelta
     lastprint = time.time()
 
     termfilter = tf(main, helper, console_handlers, params.options.quiet)
@@ -609,7 +610,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
         try:
             if (lastprint + printinterval) <= time.time():
                 termfilter.keepAlive(printinterval)
-                printinterval += 5000
+                printinterval += printintervaldelta
             event = eventHandler.waitEvent(0)
             if event is None:
                 if main.shutdown > 1:
@@ -640,7 +641,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
 
             if isinstance(event, logging.LogRecord):
                 lastprint = time.time()
-                printinterval = 5000
+                printinterval = printintervaldelta
                 if event.levelno >= bb.msg.BBLogFormatter.ERROR:
                     errors = errors + 1
                     return_value = 1
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-21 18:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 18:20 [bitbake][dunfell][1.46][PATCH 0/5] Patch review Steve Sakoman
2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 1/5] server/process: Disable gc around critical section Steve Sakoman
2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 2/5] tinfoil/data_smart: Allow variable history emit() to function remotely Steve Sakoman
2022-06-21 18:20 ` [bitbake][dunfell][1.46][PATCH 3/5] bin/bitbake-getvar: Add a new command to query a variable value (with history) Steve Sakoman
2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 4/5] knotty: display active tasks when printing keepAlive() message Steve Sakoman
2022-06-21 18:21 ` [bitbake][dunfell][1.46][PATCH 5/5] knotty: reduce keep-alive timeout from 5000s (83 minutes) to 10 minutes Steve Sakoman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.