At Tue, 28 Jun 2016 14:25:00 +0900, IWAMOTO Toshihiro wrote: > > If an AppManager.close call is started and all AppManager.services > are stop, AppManager.run_apps starts another close() call, > resulting in a strange error in close(). Prevent that using > a semaphore. > > Signed-off-by: IWAMOTO Toshihiro <iwam...@valinux.co.jp> > --- > ryu/base/app_manager.py | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-)
This patch is needed to solve a bug reported in OpenStack. https://launchpad.net/bugs/1589746 I don't like this patch, but I couldn't think of an alternative. If you have any good idea, please speak up. > diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py > index 13e41f4..f684259 100644 > --- a/ryu/base/app_manager.py > +++ b/ryu/base/app_manager.py > @@ -386,6 +386,7 @@ class AppManager(object): > self.applications = {} > self.contexts_cls = {} > self.contexts = {} > + self.close_sem = hub.Semaphore() > > def load_app(self, name): > mod = utils.import_module(name) > @@ -541,7 +542,10 @@ class AppManager(object): > self._close(app) > close_dict.clear() > > - for app_name in list(self.applications.keys()): > - self.uninstantiate(app_name) > - assert not self.applications > - close_all(self.contexts) > + # This semaphore prevents parallel execution of this function, > + # as run_apps's finally clause starts another close() call. > + with self.close_sem: > + for app_name in list(self.applications.keys()): > + self.uninstantiate(app_name) > + assert not self.applications > + close_all(self.contexts) > -- > 2.1.4 > > > ------------------------------------------------------------------------------ > Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel