diff options
author | Rafael H. Schloming <rhs@apache.org> | 2010-03-23 20:34:58 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2010-03-23 20:34:58 +0000 |
commit | 7cfa62f6187ddecfdf7149cc501778b66d8cfcc8 (patch) | |
tree | 182e61f704191fb5471b6a1cd316bda5c426b2e1 /python/qpid/tests | |
parent | 858769adbb30ff616f39f20c9ecc1a0bd3349205 (diff) | |
download | qpid-python-7cfa62f6187ddecfdf7149cc501778b66d8cfcc8.tar.gz |
fixed resource leakage on repeated connection open/close
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@926766 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/tests')
-rw-r--r-- | python/qpid/tests/messaging/endpoints.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/python/qpid/tests/messaging/endpoints.py b/python/qpid/tests/messaging/endpoints.py index 5d4fc1646b..5888413f2f 100644 --- a/python/qpid/tests/messaging/endpoints.py +++ b/python/qpid/tests/messaging/endpoints.py @@ -20,7 +20,7 @@ # setup, usage, teardown, errors(sync), errors(async), stress, soak, # boundary-conditions, config -import time +import errno, os, time from qpid import compat from qpid.messaging import * from qpid.tests.messaging import Base @@ -48,6 +48,29 @@ class SetupTests(Base): # XXX: should verify that e includes appropriate diagnostic info pass + def use_fds(self): + fds = [] + try: + while True: + fds.append(os.open("/dev/null", os.O_RDONLY)) + except OSError, e: + if e.errno != errno.EMFILE: + raise e + else: + return fds + + def testOpenCloseResourceLeaks(self): + fds = self.use_fds() + try: + for i in range(32): + if fds: os.close(fds.pop()) + for i in xrange(64): + conn = Connection.open(self.broker.host, self.broker.port) + conn.close() + finally: + while fds: + os.close(fds.pop()) + class ConnectionTests(Base): def setup_connection(self): |