GitHub user cliffjansen opened a pull request:
https://github.com/apache/qpid-proton/pull/93
PROTON-1312: fix memory leak on BlockingConnection.close()
Instrumenting the C code shows that Python BlockingConnections never
free their underlying connections, sessions and links, and frequently
the reactor too.
The BlockingConnection stops processing its dedicated reactor abruptly
on close preventing normal shutdown and cleanup operations from taking
place. Plus there are some circular references that keep some
structures alive.
The reactor C code keeps a connection and its children alive until
after the PN_CONNECTION_FINAL has completed dispatch processing. The
BlockingConnection must continue processing the container at least
that far. However, any unprocessed event can can contain a relevant
refcounted context so the safe route is to drain all remaining events
(including the PN_REACTOR_FINAL).
The SessionPerConnection class keeps the session alive by assigning a
context that is never used perhaps for some previous use in a handler.
This class is not currently used as a handler and its
on_session_remote_close is never called. Removing the context
eliminates one needless refcount.
self.conn.free() is required to trigger a pn_connection_release() on
the blocking connection.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cliffjansen/qpid-proton pn1312
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/qpid-proton/pull/93.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #93
----
commit 4408b8c9d2b2e7bc8a87e0010137c8deca03de22
Author: Cliff Jansen <[email protected]>
Date: 2017-01-10T00:06:50Z
PROTON-1312: fix memory leak on BlockingConnection.close()
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]