<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/poky.git/bitbake/lib/bb/event.py, branch 5.2_M2</title>
<subtitle>Mirror of git.yoctoproject.org/poky</subtitle>
<id>https://git.enea.com/cgit/linux/poky.git/atom?h=5.2_M2</id>
<link rel='self' href='https://git.enea.com/cgit/linux/poky.git/atom?h=5.2_M2'/>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/'/>
<updated>2024-11-28T00:06:24+00:00</updated>
<entry>
<title>bitbake: Remove custom exception backtrace formatting</title>
<updated>2024-11-28T00:06:24+00:00</updated>
<author>
<name>Joshua Watt</name>
<email>JPEWhacker@gmail.com</email>
</author>
<published>2024-11-27T22:10:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=29da7370d219924a7f1fa106b13f601ec8795eab'/>
<id>urn:sha1:29da7370d219924a7f1fa106b13f601ec8795eab</id>
<content type='text'>
Removes the code in bitbake to show custom backtrace formatting for
exceptions. In particular, the bitbake exception code prints function
arguments, which while helpful is a security problem when passwords and
other secrets can be passed as function arguments.

As it turns out, the handling of the custom serialized exception stack
frames was pretty much made obsolete by d7db75020ed ("event/msg: Pass
formatted exceptions"), which changed the events to pass a preformatted
stacktrack list of strings, but the passing of the serialized data was
never removed.

Change all the code to use the python traceback API to format exceptions
instead of the custom code; conveniently traceback.format_exception()
also returns a list of stack trace strings, so it can be used as a drop
in replacement for bb.exception.format_exception()

(Bitbake rev: 2cda75a185aaf8f657f072dac34f8cef9d75f63a)

Signed-off-by: Joshua Watt &lt;JPEWhacker@gmail.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: event: Inject empty lines to make code match lineno in filename</title>
<updated>2024-01-10T13:55:33+00:00</updated>
<author>
<name>Robert Yang</name>
<email>liezhi.yang@windriver.com</email>
</author>
<published>2024-01-09T07:45:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=3f415929200c44850b27e70ecafc70c7de4692f4'/>
<id>urn:sha1:3f415929200c44850b27e70ecafc70c7de4692f4</id>
<content type='text'>
So that we can get the correct error messages.

* In python 3.10.9, the error message was:
  ERROR: Unable to register event handler 'defaultbase_eventhandler':
    File "/path/to/poky/meta/classes-global/base.bbclass", line 4
      # SPDX-License-Identifier: MIT
             ^^^^^
  SyntaxError: invalid syntax

  This is hard to debug since the error line number 4 is incorrect, but nothing
  is wrong with the code in line 4.

* Now the error message and lineno is correct:
  ERROR: Unable to register event handler 'defaultbase_eventhandler':
    File "/path/to/poky/meta/classes-global/base.bbclass", line 256
      an error line
         ^^^^^
  SyntaxError: invalid syntax

And no impact on parsing time:
* Before:
$ rm -fr cache tmp; time bitbake -p
real    0m27.254s

* Now:
$ rm -fr cache tmp; time bitbake -p
real    0m27.200s

(Bitbake rev: c212933d9c786806852c87f188250a4f0a14c048)

Signed-off-by: Robert Yang &lt;liezhi.yang@windriver.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: bitbake: cooker: add a new function to retrieve task signatures</title>
<updated>2023-09-28T11:38:26+00:00</updated>
<author>
<name>Julien Stephan</name>
<email>jstephan@baylibre.com</email>
</author>
<published>2023-09-25T08:04:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=8eeb58cf4a34546ca0c5dd6518ece317d8706c40'/>
<id>urn:sha1:8eeb58cf4a34546ca0c5dd6518ece317d8706c40</id>
<content type='text'>
adding a new command in cooker to compute and get task signatures

this commit also add the associated command and event needed to get the
signatures using tinfoil

(Bitbake rev: 05c15162de90c41dad67e37a95ec9fdb440a7864)

Signed-off-by: Julien Stephan &lt;jstephan@baylibre.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event: add bb.event.ParseError</title>
<updated>2023-04-13T11:01:45+00:00</updated>
<author>
<name>Mingli Yu</name>
<email>mingli.yu@windriver.com</email>
</author>
<published>2023-04-12T07:32:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=066f44b1617f3d25d66d41340205b3b585086eaa'/>
<id>urn:sha1:066f44b1617f3d25d66d41340205b3b585086eaa</id>
<content type='text'>
Add bb.event.ParseError to let error-report can catch this kind of error.

(Bitbake rev: 316524ab59a5e738c25e062923ee5717d88ae5c7)

Signed-off-by: Mingli Yu &lt;mingli.yu@windriver.com&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event/cooker/runqueue: Add ability to interrupt longer running code</title>
<updated>2023-02-23T12:12:18+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2023-02-22T13:31:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=42c92cbc83a56249203aeb23fe524f9b4eebbdf9'/>
<id>urn:sha1:42c92cbc83a56249203aeb23fe524f9b4eebbdf9</id>
<content type='text'>
Bitbake is now able to understand when a UI wants it to stop the current
processing. There are some long running functions which currently have no
mechanism to interrupt them however.

This patch adds a call, bb.event.check_for_interrupts(d) which can be
placed in long running code and allows an internal state flag within
bitbake to be checked. If set, that flag will trigger an exit.

This means that Ctrl+C can be made to work in a variety of places where
it currently would not.

Long running event handlers in OE-Core can also then benefit from this
new approach with the addition of the function call as well.

(Bitbake rev: b7ed7e9a815c4e10447fd499508be3dbb47f06e8)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: lib/bb: Update thread/process locks to use a timeout</title>
<updated>2023-01-05T11:50:17+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2023-01-04T12:32:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=a19687acd12497d727203e63d74b2703387f34a6'/>
<id>urn:sha1:a19687acd12497d727203e63d74b2703387f34a6</id>
<content type='text'>
The thread/process locks we use translate to futexes in Linux. If a
process dies holding the lock, anything else trying to take the lock
will hang indefinitely. An example would be the OOM killer taking out
a parser process.

To avoid bitbake processes just hanging indefinitely, add a timeout to
our lock calls using a context manager. If we can't obtain the lock
after waiting 5 minutes, hard exit out using os._exit(1). Use _exit()
to avoid locking in any other places trying to write error messages to
event handler queues (which also need locks).

Whilst a bit harsh, this should mean we stop having lots of long running
processes in cases where things are never going to work out and also
avoids hanging builds on the autobuilder.

(Bitbake rev: d2a3f662b0eed900fc012a392bfa0a365df0df9b)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event: Always use threadlock</title>
<updated>2022-12-31T17:05:17+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2022-12-21T14:43:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=6a6a5c01f768f2af581f1f764a3a1c40864459e7'/>
<id>urn:sha1:6a6a5c01f768f2af581f1f764a3a1c40864459e7</id>
<content type='text'>
With the move to a server idle thread, we always need threading. The
existing accessor functions could end up turning this off!

I was going to hold the lock whilst changing it, check if the value
was already set, cache the result and also fix the event code to always
release the lock with a try/finally.

Instead, disable the existing functions and use a with: block
to handle the lock, keeping things much simpler.

(Bitbake rev: 645c9d3b50e55f69b222cc338373cdfd91d524ce)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event: Add enable/disable heartbeat code</title>
<updated>2022-12-31T17:05:17+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2022-12-20T14:17:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=cb8efd4d20d7643632b04ce8350c1b58aed49122'/>
<id>urn:sha1:cb8efd4d20d7643632b04ce8350c1b58aed49122</id>
<content type='text'>
Currently heartbeat events are always generated by the server whilst it is
active. Change this so they only appear when builds are running, which is
when most code would expect to be executed. This removes a number of races
around changes in the datastore which can happen outside of builds.

(Bitbake rev: 8c36c90afc392980d999a981a924dc7d22e2766e)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event: builtins fix for 'd' deletion</title>
<updated>2022-12-29T00:07:06+00:00</updated>
<author>
<name>Richard Purdie</name>
<email>richard.purdie@linuxfoundation.org</email>
</author>
<published>2022-12-20T14:20:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=907e91796ed4156cafcbd3ee60edaa9544f0abe3'/>
<id>urn:sha1:907e91796ed4156cafcbd3ee60edaa9544f0abe3</id>
<content type='text'>
I've been seeing event handlers where 'd' seems to disappear half way through
event handler execution. This is problematic when multiple threads are active
since this code assumes single threading.

The easiest fix is to change the handler function calls to contain d as a
parameter as we do elsewhere for other functions. This will break any non-text
handlers but I was only able to spot one of those in runqueue. It will also
break handlers than call functions that assume 'd' is in the global namespace
but those failures should be obvious and we can fix those to pass d around.

This solution avoids manipulating builtins which was always a horrible thing
to do anyway and solves the issue without needing locking, thankfully.

(Bitbake rev: 1e12f0a4b592dacd006d370ec29cd71d2a44312e)

Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>bitbake: event.py: ignore exceptions from stdout and sterr operations in atexit</title>
<updated>2022-06-11T09:30:56+00:00</updated>
<author>
<name>Mikko Rapeli</name>
<email>mikko.rapeli@bmw.de</email>
</author>
<published>2022-06-09T05:56:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/linux/poky.git/commit/?id=5ed5a3cc8a4d819a0af8ee59f0c960bc4de07b61'/>
<id>urn:sha1:5ed5a3cc8a4d819a0af8ee59f0c960bc4de07b61</id>
<content type='text'>
When atexit functions run, stdout and stderr operations may fail, e.g.
when output is piped to less but has been exited by the user.
This removes error print from output of "bitbake -e sqlite3 | less"
if user presses "q" before bitbake has finished processing:

[Errno 32] Broken pipeError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/builder/src/poky/bitbake/lib/bb/event.py", line 135, in print_ui_queue
    sys.stdout.flush()

(Bitbake rev: 35167536c163eb6b7653cbcaad9f65b834d3e2f8)

Signed-off-by: Mikko Rapeli &lt;mikko.rapeli@bmw.de&gt;
Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;
</content>
</entry>
</feed>
