zbentley opened a new pull request #14585: URL: https://github.com/apache/pulsar/pull/14585
Fixes https://github.com/apache/pulsar/issues/14583 ### Motivation The Python client bindings make it very easy to leak Pulsar client objects. Those leaks manifest in segfaults and program crashes (e.g. https://github.com/apache/pulsar/issues/14582). ### Modifications Adds an abstract superclass of all stateful python client objects (clients, consumers, readers, producers) which coordinates garbage collection of those objects, according to these principles: - Disposing of an object should close its underlying resources. - If the only reference a program holds is to a "child" object (one descended from a client) and that child is disposed of, the parent client that created it should also then be disconnected and destroyed. ### Verifying this change This change added tests and can be verified as follows: - Added a test case to `test_pulsar` which ensures that no file handles are leaked after consumer objects are destroyed. This test runs under an artificially lowered file handle limit; if handles are leaked, errors will be raised (well, segfaults and sigaborts are raised right now, but errors will be raised after #14582 is fixed). ### Documentation I do not believe that this PR affects external API contracts or behavior. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
