-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 14583: [python client]: Improve garbage collection of producer/consumer/reader objects #14585
Issue 14583: [python client]: Improve garbage collection of producer/consumer/reader objects #14585
Conversation
@zbentley:Thanks for your contribution. For this PR, do we need to update docs? |
@zbentley:Thanks for providing doc info! |
Could you fix the license check? |
The pr had no activity for 30 days, mark with Stale label. |
Fixing license check and tests this week or next, sorry for delay. |
It looks like the |
I think the py2 support at this time is out of any reasonable time :) I just submitted proposal to drop Py2. #15185. We should be able to do that in few days. |
Unsure why the two most recent commits haven't finished their build. Is there an issue with CI? Or a problem with this PR? |
You can see error logs in https://github.com/apache/pulsar/runs/6155320188?check_suite_focus=true.
Debugging for the Python2 code is somehow troublesome. I usually build the Python2 wheels in a CentOS 7 docker with If you are not in a hurry to merge this PR, maybe it's better to wait until PIP-155 is done. After that, you can restore this PR to the Python3 compatible code. |
@BewareMyPower there's no hurry. I'll fix up this code regardless since it needed a few tweaks. The build failures weren't due to that AttributeError, though (destruction time errors are ugly, but don't cause tests to fail with exceptions); they seemed to be due to the BROKER_CONNECTION, FUNCTION, and FLAKY builds. |
…ld_handle_garbage_collection
The pr had no activity for 30 days, mark with Stale label. |
@zbentley Could you resolve the conflicts in master branch? P.S. This PR can only be cherry-picked into branch-2.11 because Pulsar drops the Python2 support since 2.11.0 |
@zbentley Please provide a correct documentation label for your PR. |
Closed as the development of the Python client has been permanently moved to https://github.com/apache/pulsar-client-python. |
Fixes apache/pulsar-client-python#42
Motivation
The Python client bindings make it very easy to leak Pulsar client objects. Those leaks manifest in segfaults and program crashes (e.g. #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:
Verifying this change
This change added tests and can be verified as follows:
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 C++/Python pulsar client abort()s or segfaults on file descriptor exhaustion ("Too many open files") #14582 is fixed).Documentation
no-need-doc
I do not believe that this PR affects external API contracts or behavior.