You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/07 15:43:21 UTC

[GitHub] [pulsar] zbentley opened a new issue #14583: Disposing of a Python Consumer object without calling close() leaks file descriptors and does not close the consumer.

zbentley opened a new issue #14583:
URL: https://github.com/apache/pulsar/issues/14583


   **Describe the bug**
   If a Python pulsar-client Consumer object is destroyed (garbage collected) without its `close()` method being called, the consumer remains connected, and its file descriptors remain open.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Run the below snippet.
   2. Observe that it segfaults (due to https://github.com/apache/pulsar/issues/14582). 
   
   ```python
   import logging
   import resource
   import pulsar
   
   def main():
       resource.setrlimit(resource.RLIMIT_NOFILE, (15, 15))
       consumers = []
       for i in range(100):
           client = pulsar.Client(service_url='pulsar://localhost', logger=logging.getLogger())
           print(f"creating mysub-{i}")
           con = client.subscribe(topic='mytopic', subscription_name=f'mysub-{i}')
   
   
   if __name__ == '__main__':
       main()
   
   ```
   
   **Expected behavior**
   Garbage collecting consumers should result in their no longer being present on the system.
   
   **Desktop (please complete the following information):**
    - OS: MacOS Monterey (x86)
    - Pulsar client 2.9.1
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org