Timeouts get porpagated out of tpool.execute.

This commit is contained in:
Ryan Williams
2011-04-12 23:50:20 -07:00
parent 83d35288d7
commit d00d6df789
3 changed files with 15 additions and 5 deletions

5
NEWS
View File

@@ -2,11 +2,12 @@
====== ======
* ZeroMQ support without an explicit hub now implemented! Thanks to Zed Shaw for the patch. * ZeroMQ support without an explicit hub now implemented! Thanks to Zed Shaw for the patch.
* zmq module supports the NOBLOCK flag, thanks to rfk. (#76) * zmq module supports the NOBLOCK flag, thanks to rfk. (#76)
* eventlet.wsgi has a debug flag which can be set to false to not send tracebacks to the client * eventlet.wsgi has a debug flag which can be set to false to not send tracebacks to the client (per redbo's request)
* Recursive GreenPipe madeness forestalled by Soren Hansen (#77) * Recursive GreenPipe madness forestalled by Soren Hansen (#77)
* eventlet.green.ssl no longer busywaits on send() * eventlet.green.ssl no longer busywaits on send()
* EEXIST ignored in epoll hub (#80) * EEXIST ignored in epoll hub (#80)
* eventlet.listen's behavior on Windows improved, thanks to Nick Vatamaniuc (#83) * eventlet.listen's behavior on Windows improved, thanks to Nick Vatamaniuc (#83)
* Timeouts raised within tpool.execute are propagated back to the caller (thanks again to redbo for being the squeaky wheel)
0.9.14 0.9.14
====== ======

View File

@@ -21,6 +21,7 @@ from eventlet import event
from eventlet import greenio from eventlet import greenio
from eventlet import greenthread from eventlet import greenthread
from eventlet import patcher from eventlet import patcher
from eventlet import timeout
threading = patcher.original('threading') threading = patcher.original('threading')
Queue_module = patcher.original('Queue') Queue_module = patcher.original('Queue')
Queue = Queue_module.Queue Queue = Queue_module.Queue
@@ -58,7 +59,7 @@ def tpool_trampoline():
SYS_EXCS = (KeyboardInterrupt, SystemExit) SYS_EXCS = (KeyboardInterrupt, SystemExit)
EXC_CLASSES = (Exception, timeout.Timeout)
def tworker(reqq): def tworker(reqq):
global _rspq global _rspq
@@ -75,7 +76,7 @@ def tworker(reqq):
rv = meth(*args,**kwargs) rv = meth(*args,**kwargs)
except SYS_EXCS: except SYS_EXCS:
raise raise
except Exception: except EXC_CLASSES:
rv = sys.exc_info() rv = sys.exc_info()
# test_leakage_from_tracebacks verifies that the use of # test_leakage_from_tracebacks verifies that the use of
# exc_info does not lead to memory leaks # exc_info does not lead to memory leaks
@@ -116,7 +117,9 @@ def execute(meth,*args, **kwargs):
reqq.put((e,meth,args,kwargs)) reqq.put((e,meth,args,kwargs))
rv = e.wait() rv = e.wait()
if isinstance(rv,tuple) and len(rv) == 3 and isinstance(rv[1],Exception): if isinstance(rv,tuple) \
and len(rv) == 3 \
and isinstance(rv[1],EXC_CLASSES):
import traceback import traceback
(c,e,tb) = rv (c,e,tb) = rv
if not QUIET: if not QUIET:

View File

@@ -269,6 +269,12 @@ class TestTpool(LimitedTestCase):
x = tpool.Proxy(wrapped, autowrap_names=('__call__',)) x = tpool.Proxy(wrapped, autowrap_names=('__call__',))
for r in x(3): for r in x(3):
self.assertEquals(3, r) self.assertEquals(3, r)
@skip_with_pyevent
def test_eventlet_timeout(self):
def raise_timeout():
raise eventlet.Timeout()
self.assertRaises(eventlet.Timeout, tpool.execute, raise_timeout)
class TpoolLongTests(LimitedTestCase): class TpoolLongTests(LimitedTestCase):
TEST_TIMEOUT=60 TEST_TIMEOUT=60