diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2010-04-09 11:39:38 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2010-04-09 11:39:38 +0000 |
| commit | 6c206f8f0e142a4c112e36cf5c852a12bcf445a6 (patch) | |
| tree | 22e300099d05ea6b251c8b325f0104cb2cbd3dbe /qpid/python | |
| parent | 2acf0c3e804e59ecfc5b3dbbd9a34e07e92b5b11 (diff) | |
| download | qpid-python-6c206f8f0e142a4c112e36cf5c852a12bcf445a6.tar.gz | |
cleanup waiter pipes on error
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@932362 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/messaging/endpoints.py | 1 | ||||
| -rw-r--r-- | qpid/python/qpid/tests/messaging/endpoints.py | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/qpid/python/qpid/messaging/endpoints.py b/qpid/python/qpid/messaging/endpoints.py index 17807f20d2..be657173fe 100644 --- a/qpid/python/qpid/messaging/endpoints.py +++ b/qpid/python/qpid/messaging/endpoints.py @@ -174,6 +174,7 @@ class Connection: def _check_error(self, exc=ConnectionError): if self.error: + self._condition.gc() raise exc(*self.error) def _ewait(self, predicate, timeout=None, exc=ConnectionError): diff --git a/qpid/python/qpid/tests/messaging/endpoints.py b/qpid/python/qpid/tests/messaging/endpoints.py index 26c7ff25f4..320f88aa3b 100644 --- a/qpid/python/qpid/tests/messaging/endpoints.py +++ b/qpid/python/qpid/tests/messaging/endpoints.py @@ -67,6 +67,26 @@ class SetupTests(Base): while fds: os.close(fds.pop()) + def testOpenFailResourceLeaks(self): + fds = self.use_fds() + try: + for i in range(32): + if fds: os.close(fds.pop()) + for i in xrange(64): + conn = Connection("localhost:0", **self.connection_options()) + # XXX: we need to force a waiter to be created for this test + # to work + conn._lock.acquire() + conn._wait(lambda: False, timeout=0.001) + conn._lock.release() + try: + conn.open() + except ConnectError, e: + pass + finally: + while fds: + os.close(fds.pop()) + def testReconnect(self): options = self.connection_options() import socket |
