diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-24 13:19:32 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-24 15:38:24 +0000 |
| commit | 584a913d756ebe7f4522167446ca1a7463a101af (patch) | |
| tree | 81f8f43afde47def60567515f5e387de6d03bd67 /bitbake/lib | |
| parent | 9b0277c3c3be7637e7cee2d2a04f67cb00ac0226 (diff) | |
| download | poky-584a913d756ebe7f4522167446ca1a7463a101af.tar.gz | |
bitbake: cooker: Fix memory resident cache invalidation issue
We've been seeing weird PRServ failures on the autobuilder. These had
one failure always followed by a second. Whilst I can't reproduce the first,
if I made that test fail, I could reproduce the second with memory resident
bitbake. This was with the tests:
prservice.BitbakePrTests.test_import_export_replace_db
and then
prservice.BitbakePrTests.test_pr_service_deb_arch_dep
which was giving a strange looking error:
NOTE: Running task 1053 of 1055 (/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/recipes-devtools/m4/m4_1.4.19.bb:do_package_write_rpm)
NOTE: Running task 1054 of 1055 (/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/recipes-devtools/m4/m4_1.4.19.bb:do_package_qa)
ERROR: No such task: do_package_write_rpm
ERROR: Task (/home/pokybuild/yocto-worker/oe-selftest-debian/build/meta/recipes-devtools/m4/m4_1.4.19.bb:do_package_write_rpm) failed with exit code '1'
where the issue is that selftest.inc written by the test framework
and containing PACKAGE_CLASSES = "package_deb" was being ignored.
The issue is the cached_statements{} within BBHandler() is not being
invalidated at the right time.
This patch changes the code to ensure base configuration is not parsed
until inotify updates have been processed.
(Bitbake rev: cada37c6b9e5862ca2c5a54ad6fd1e1f1939cd9c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index c631ec7e6d..1797a1d4ca 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -339,6 +339,14 @@ class BBCooker: | |||
| 339 | providerlog.error("Root privilege is required to modify max_user_watches.") | 339 | providerlog.error("Root privilege is required to modify max_user_watches.") |
| 340 | raise | 340 | raise |
| 341 | 341 | ||
| 342 | def handle_inotify_updates(self): | ||
| 343 | # reload files for which we got notifications | ||
| 344 | for p in self.inotify_modified_files: | ||
| 345 | bb.parse.update_cache(p) | ||
| 346 | if p in bb.parse.BBHandler.cached_statements: | ||
| 347 | del bb.parse.BBHandler.cached_statements[p] | ||
| 348 | self.inotify_modified_files = [] | ||
| 349 | |||
| 342 | def sigterm_exception(self, signum, stackframe): | 350 | def sigterm_exception(self, signum, stackframe): |
| 343 | if signum == signal.SIGTERM: | 351 | if signum == signal.SIGTERM: |
| 344 | bb.warn("Cooker received SIGTERM, shutting down...") | 352 | bb.warn("Cooker received SIGTERM, shutting down...") |
| @@ -368,6 +376,7 @@ class BBCooker: | |||
| 368 | if mod not in self.orig_sysmodules: | 376 | if mod not in self.orig_sysmodules: |
| 369 | del sys.modules[mod] | 377 | del sys.modules[mod] |
| 370 | 378 | ||
| 379 | self.handle_inotify_updates() | ||
| 371 | self.setupConfigWatcher() | 380 | self.setupConfigWatcher() |
| 372 | 381 | ||
| 373 | # Need to preserve BB_CONSOLELOG over resets | 382 | # Need to preserve BB_CONSOLELOG over resets |
| @@ -1614,12 +1623,7 @@ class BBCooker: | |||
| 1614 | if self.state == state.running: | 1623 | if self.state == state.running: |
| 1615 | return | 1624 | return |
| 1616 | 1625 | ||
| 1617 | # reload files for which we got notifications | 1626 | self.handle_inotify_updates() |
| 1618 | for p in self.inotify_modified_files: | ||
| 1619 | bb.parse.update_cache(p) | ||
| 1620 | if p in bb.parse.BBHandler.cached_statements: | ||
| 1621 | del bb.parse.BBHandler.cached_statements[p] | ||
| 1622 | self.inotify_modified_files = [] | ||
| 1623 | 1627 | ||
| 1624 | if not self.baseconfig_valid: | 1628 | if not self.baseconfig_valid: |
| 1625 | logger.debug("Reloading base configuration data") | 1629 | logger.debug("Reloading base configuration data") |
