summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/base/app_manager.py12
-rw-r--r--ryu/lib/hub.py7
2 files changed, 15 insertions, 4 deletions
diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index cc510087..0a35e915 100644
--- a/ryu/base/app_manager.py
+++ b/ryu/base/app_manager.py
@@ -286,7 +286,17 @@ class RyuApp(object):
continue
handlers = self.get_handlers(ev, state)
for handler in handlers:
- handler(ev)
+ try:
+ handler(ev)
+ except hub.TaskExit:
+ # Normal exit.
+ # Propagate upwards, so we leave the event loop.
+ raise
+ except:
+ LOG.exception('%s: Exception occurred during handler processing. '
+ 'Backtrace from offending handler '
+ '[%s] servicing event [%s] follows.',
+ self.name, handler.__name__, ev.__class__.__name__)
def _send_event(self, ev, state):
self._events_sem.acquire()
diff --git a/ryu/lib/hub.py b/ryu/lib/hub.py
index ce5e150f..b77465bf 100644
--- a/ryu/lib/hub.py
+++ b/ryu/lib/hub.py
@@ -50,7 +50,7 @@ if HUB_TYPE == 'eventlet':
# by not propergating an exception to the joiner.
try:
func(*args, **kwargs)
- except greenlet.GreenletExit:
+ except TaskExit:
pass
except:
# log uncaught exception.
@@ -67,7 +67,7 @@ if HUB_TYPE == 'eventlet':
# by not propergating an exception to the joiner.
try:
func(*args, **kwargs)
- except greenlet.GreenletExit:
+ except TaskExit:
pass
except:
# log uncaught exception.
@@ -87,13 +87,14 @@ if HUB_TYPE == 'eventlet':
# greenthread
try:
t.wait()
- except greenlet.GreenletExit:
+ except TaskExit:
pass
Queue = eventlet.queue.LightQueue
QueueEmpty = eventlet.queue.Empty
Semaphore = eventlet.semaphore.Semaphore
BoundedSemaphore = eventlet.semaphore.BoundedSemaphore
+ TaskExit = greenlet.GreenletExit
class StreamServer(object):
def __init__(self, listen_info, handle=None, backlog=None,