You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by cl...@apache.org on 2021/04/02 18:50:12 UTC
[qpid-proton] 01/01: PROTON-2344: fix Python BlockingConnection
resource leaks, memory and socket fds
This is an automated email from the ASF dual-hosted git repository.
cliffjansen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 69339dedbb2ec8d6f934e7de08d021e525312c03
Author: Cliff Jansen <cl...@apache.org>
AuthorDate: Fri Apr 2 11:46:39 2021 -0700
PROTON-2344: fix Python BlockingConnection resource leaks, memory and socket fds
---
python/proton/_utils.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/python/proton/_utils.py b/python/proton/_utils.py
index 52bdfc2..275f12b 100644
--- a/python/proton/_utils.py
+++ b/python/proton/_utils.py
@@ -440,12 +440,16 @@ class BlockingConnection(Handler):
self.conn.close()
self.wait(lambda: not (self.conn.state & Endpoint.REMOTE_ACTIVE),
msg="Closing connection")
+ if self.conn.transport:
+ # Close tail to force transport cleanup without waiting/hanging for peer close frame.
+ self.conn.transport.close_tail()
finally:
self.conn.free()
# Nothing left to block on. Allow reactor to clean up.
self.run()
- self.conn = None
- self.container.global_handler = None # break circular ref: container to cadapter.on_error
+ if self.conn:
+ self.conn.handler = None # break cyclical reference
+ self.conn = None
self.container.stop_events()
self.container = None
@@ -502,9 +506,6 @@ class BlockingConnection(Handler):
raise Timeout(txt)
finally:
self.container.timeout = container_timeout
- if self.disconnected or self._is_closed():
- self.container.stop()
- self.conn.handler = None # break cyclical reference
if self.disconnected and not self._is_closed():
raise ConnectionException(
"Connection %s disconnected: %s" % (self.url, self.disconnected))
@@ -534,7 +535,8 @@ class BlockingConnection(Handler):
self.on_transport_closed(event)
def on_transport_closed(self, event):
- self.disconnected = event.transport.condition or "unknown"
+ if not self.closing:
+ self.disconnected = event.transport.condition or "unknown"
class AtomicCount(object):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org