Event listeners die unexpectedly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
os-win |
Fix Released
|
Medium
|
Lucian Petrut |
Bug Description
PyMI subscribes to event providers, setting a callback that will be invoked when an event arrives. When called, the event watcher will block until an event is retrieved. A threading.Event is used internally by PyMI for the event waiting workflow.
The issue is that the threading module will be monkey patched by eventlet. The event callback is performed from a different thread, so attempting to set the event for which the event watcher waits will some times raise the "error: cannot switch to a different thread" greenlet exception, thus breaking the event listener.
This issue can be fixed at the os-win level, without having PyMI to know about eventlet. We can make sure that PyMI uses the unpatched threading module, also ensuring that the blocking calls are run in a different thread, so that we don't block the calling thread, preventing other greenthreads from continuing theri execution. eventlet.tpool can be used to easily achieve this.
Changed in os-win: | |
importance: | Undecided → Medium |
assignee: | nobody → Lucian Petrut (petrutlucian94) |
description: | updated |
Reviewed: https:/ /review. openstack. org/304086 /git.openstack. org/cgit/ openstack/ os-win/ commit/ ?id=53a8d6d0b33 81e6df2823257fa 1aa1665077cea4
Committed: https:/
Submitter: Jenkins
Branch: master
commit 53a8d6d0b3381e6 df2823257fa1aa1 665077cea4
Author: Lucian Petrut <email address hidden>
Date: Mon Apr 11 14:45:44 2016 +0300
Fix event listeners
PyMI subscribes to event providers, setting a callback that will be
invoked when an event arrives. When called, the event watcher will
block until an event is retrieved. A threading.Event is used
internally by PyMI for the event waiting workflow.
The issue is that the threading module will be monkey patched by
eventlet. The event callback is performed from a different thread, so
attempting to set the event for which the event watcher waits will
some times raise the "error: cannot switch to a different thread"
greenlet exception, thus breaking the event listener.
This issue can be fixed at the os-win level, without PyMI having to
know about eventlet monkey patching. We can make sure that PyMI uses
the unpatched threading module, also ensuring that the blocking calls
are run in a different thread, so that we don't block the calling
thread. eventlet.tpool can be used to easily achieve this.
Closes-Bug: #1568824
Change-Id: I9be6c1a1b144bd f565f25517c5243 9a5fb10cb51