aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-23 19:24:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-09 14:33:43 +0000
commita9cd657a01ad1158427f9539220694e77de896a2 (patch)
tree0af2d1607dc23041077dd3fd01d14104b346bf98
parentc504276d260571da38a20ff9c58ffc2e0c760fbb (diff)
downloadopenembedded-core-contrib-a9cd657a01ad1158427f9539220694e77de896a2.tar.gz
bitbake: cooker: read file watches on server idle
The inotify facility monitoring changes to the config files could be overwhelmed by massive changes to the watched files while server is running. This patch adds verification the notification watches to the server idle functions, in addition to the cooker updateCache command which executes only infrequently, thus preventing overflowing the notification buffer. [YOCTO #7316] (Bitbake rev: 996e663fd5c254292f44eca46f5fdc95af897f98) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/cooker.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 0bbbc09c33..5ebf6a1328 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -133,6 +133,19 @@ class BBCooker:
self.initConfigurationData()
+
+ 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()
+ return True
+
+ self.configuration.server_register_idlecallback(_process_inotify_updates, [self.confignotifier, self.notifier])
+
self.baseconfig_valid = True
self.parsecache_valid = False
@@ -171,11 +184,13 @@ class BBCooker:
signal.signal(signal.SIGHUP, self.sigterm_exception)
def config_notifications(self, event):
- bb.parse.update_cache(event.path)
+ if not event.path in self.inotify_modified_files:
+ self.inotify_modified_files.append(event.path)
self.baseconfig_valid = False
def notifications(self, event):
- bb.parse.update_cache(event.path)
+ if not event.path in self.inotify_modified_files:
+ self.inotify_modified_files.append(event.path)
self.parsecache_valid = False
def add_filewatch(self, deps, watcher=None):
@@ -1419,11 +1434,12 @@ class BBCooker:
raise bb.BBHandledException()
if self.state != state.parsing:
- 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()
+
+ # reload files for which we got notifications
+ for p in self.inotify_modified_files:
+ bb.parse.update_cache(p)
+ self.inotify_modified_files = []
+
if not self.baseconfig_valid:
logger.debug(1, "Reloading base configuration data")
self.initConfigurationData()