Created
August 11, 2012 12:07
-
-
Save edwardgeorge/3324089 to your computer and use it in GitHub Desktop.
similar bug found with dead eventlet runloop. a greenthread doesn't get its parent set to new hub greenlet unless switching back to the hub. If it dies before then it'll return execution to dead hub greenlet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
def dummyproc(): | |
print 'dummyproc returning. but our parent is *old, dead* hub greenlet' | |
eventlet.sleep(0) # give hub a chance to run | |
g = eventlet.spawn(dummyproc) | |
print 'killing hub before spawned greenthread timer is run' | |
try: | |
# use throw() method on greenlet rather | |
# than eventlet.greenthread.kill() | |
eventlet.hubs.get_hub().greenlet.throw(KeyboardInterrupt()) | |
except KeyboardInterrupt: | |
pass | |
print 'killed hub. switching back to create new runloop greenlet' | |
eventlet.hubs.get_hub().switch() | |
print 'should not get here!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment