Protect events queue with a semaphore, due to a discovered bug in eventlet 
queue put(). This is a temporary workaround until eventlet is fixed.

Signed-off-by: Victor J. Orlikowski <[email protected]>

---
 ryu/base/app_manager.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index 3d5d895..cc51008 100644
--- a/ryu/base/app_manager.py
+++ b/ryu/base/app_manager.py
@@ -158,6 +158,7 @@ class RyuApp(object):
         self.threads = []
         self.main_thread = None
         self.events = hub.Queue(128)
+        self._events_sem = hub.BoundedSemaphore(self.events.maxsize)
         if hasattr(self.__class__, 'LOGGER_NAME'):
             self.logger = logging.getLogger(self.__class__.LOGGER_NAME)
         else:
@@ -280,6 +281,7 @@ class RyuApp(object):
     def _event_loop(self):
         while self.is_active or not self.events.empty():
             ev, state = self.events.get()
+            self._events_sem.release()
             if ev == self._event_stop:
                 continue
             handlers = self.get_handlers(ev, state)
@@ -287,6 +289,7 @@ class RyuApp(object):
                 handler(ev)
 
     def _send_event(self, ev, state):
+        self._events_sem.acquire()
         self.events.put((ev, state))
 
     def send_event(self, name, ev, state=None):
-- 

Best,
Victor
--
Victor J. Orlikowski <> vjo@[cs.]duke.edu

Attachment: 0001-Protect-events-queue-with-a-semaphore-due-to-a-disco.patch
Description: 0001-Protect-events-queue-with-a-semaphore-due-to-a-disco.patch

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to