[
https://issues.apache.org/jira/browse/PROTON-1312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15813308#comment-15813308
]
ASF GitHub Bot commented on PROTON-1312:
----------------------------------------
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()
----
> BlockingConnection leaks Proton-C memory
> ----------------------------------------
>
> Key: PROTON-1312
> URL: https://issues.apache.org/jira/browse/PROTON-1312
> Project: Qpid Proton
> Issue Type: Bug
> Components: python-binding
> Affects Versions: 0.9, 0.15.0
> Reporter: Cliff Jansen
> Assignee: Cliff Jansen
> Labels: leak, reproducer
> Fix For: 0.17.0
>
> Attachments: ml8.py
>
>
> The attached program leaks the underlying connection (the C proton
> object) associated with the BlockingConnection on each loop iteration
> on proton 0.9 as used by Satellite. Without the receiver, it cleans
> up fine.
> On master, the program leaks both the reactor and the connection
> associated with the BlockingConnection for each loop. The receiver
> creation can be commented out and it still leaks both objects.
> Other objects may leak too (presumably session), but I have not
> examined further.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]