On Tue, Jun 28, 2016 at 3:16 PM, IWAMOTO Toshihiro <iwam...@valinux.co.jp>
wrote:

> At Tue, 28 Jun 2016 15:02:52 +0900,
> Takashi YAMAMOTO wrote:
> >
> > On Tue, Jun 28, 2016 at 2:25 PM, IWAMOTO Toshihiro <
> iwam...@valinux.co.jp>
> > wrote:
> >
> > > If an AppManager.close call is started and all AppManager.services
> > > are stop, AppManager.run_apps starts another close() call,
> > >
> >
> > why joinall in run_apps returns before AppManager.close finish clearing
> > self.applications?
>
> Because OfctlService isn't in services (run_apps local variable) and
> RyuApp.close() causes eventlet context switches?
>

why it isn't in "services"?
i thought instantiate_apps returned auto-loaded apps as well.
if not, isn't it better to fix it instead?


> > > 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(-)
> > >
> > > 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

Reply via email to