[gnome-continuous-yocto/gnomeostree-3.28-rocko: 7153/8267] bitbake: cooker: Ensure we handle inotify before running the next command
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 7153/8267] bitbake: cooker: Ensure we handle inotify before running the next command
- Date: Sun, 17 Dec 2017 05:50:54 +0000 (UTC)
commit 019f518287bb00f7e7121289b4859661af201d89
Author: Richard Purdie <richard purdie linuxfoundation org>
Date: Wed Aug 9 12:54:34 2017 +0100
bitbake: cooker: Ensure we handle inotify before running the next command
The inotify watch events are handled "at idle" which could in theory mean
a command could run before any preceeding inotify events have been processed.
This leads to a theoretical race window where those events may have a
signficicant effect on the command.
Add a mechanism to allow us to ensure all pending events are processed before
running commands.
(Bitbake rev: bf76cd7e5881adf264b8ba64e27a5b6ca9df4fde)
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/bb/command.py | 2 ++
bitbake/lib/bb/cooker.py | 17 ++++++++++-------
2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index c44c7a6..a923245 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -78,6 +78,7 @@ class Command:
if not hasattr(command_method, 'readonly') or False == getattr(command_method, 'readonly'):
return None, "Not able to execute not readonly commands in readonly mode"
try:
+ self.cooker.process_inotify_updates()
if getattr(command_method, 'needconfig', False):
self.cooker.updateCacheSync()
result = command_method(self, commandline)
@@ -98,6 +99,7 @@ class Command:
def runAsyncCommand(self):
try:
+ self.cooker.process_inotify_updates()
if self.cooker.state in (bb.cooker.state.error, bb.cooker.state.shutdown,
bb.cooker.state.forceshutdown):
# updateCache will trigger a shutdown of the parser
# and then raise BBHandledException triggering an exit
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ea4df26..77b7f3d 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -205,15 +205,11 @@ class BBCooker:
self.inotify_modified_files = []
- def _process_inotify_updates(server, notifier_list, abort):
- for n in notifier_list:
- if n.check_events(timeout=0):
- # read notified events and enqeue them
- n.read_events()
- n.process_events()
+ def _process_inotify_updates(server, cooker, abort):
+ cooker.process_inotify_updates()
return 1.0
- self.configuration.server_register_idlecallback(_process_inotify_updates, [self.confignotifier,
self.notifier])
+ self.configuration.server_register_idlecallback(_process_inotify_updates, self)
# TOSTOP must not be set or our children will hang when they output
try:
@@ -241,6 +237,13 @@ class BBCooker:
os.write(readypipe, b"ready")
os.close(readypipe)
+ def process_inotify_updates(self):
+ for n in [self.confignotifier, self.notifier]:
+ if n.check_events(timeout=0):
+ # read notified events and enqeue them
+ n.read_events()
+ n.process_events()
+
def config_notifications(self, event):
if event.maskname == "IN_Q_OVERFLOW":
bb.warn("inotify event queue overflowed, invalidating caches.")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]