You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "kansnow (via GitHub)" <gi...@apache.org> on 2024/03/27 08:13:02 UTC

[I] There is a memory leak,I need help [pulsar-client-python]

kansnow opened a new issue, #208:
URL: https://github.com/apache/pulsar-client-python/issues/208

   `import time
   import pulsar
   import sys
   import gc
   
   client = pulsar.Client('pulsar://localhost:6650')
   
   def connect_to_pulsar():
       producer = None
       try:
           producer = client.create_producer('my-topic')
           producer.send(b'Hello Pulsar!')
       except Exception as e:
           print(f"Connection to Pulsar failed: {e}")
       finally:
           size = sys.getsizeof(client)
           print(f"Memory usage of {client.__class__.__name__} object: {size} bytes")
           if producer:
               producer.close()
           gc.collect()
   
   # 模拟循环尝试连接
   for _ in range(1000000):
       connect_to_pulsar()
       time.sleep(1)
   
   # 循环结束后关闭连接
   client.close()`
   
   there is my code,I am using pulsar-client with version 2.9.1. when I run this code in python3,  Process memory keeps growing.
   Where exactly is the problem?


-- 
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.apache.org

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


Re: [I] There is a memory leak,I need help [pulsar-client-python]

Posted by "kansnow (via GitHub)" <gi...@apache.org>.
kansnow commented on issue #208:
URL: https://github.com/apache/pulsar-client-python/issues/208#issuecomment-2024274127

   > Can you try with latest version 3.4.0? https://pypi.org/project/pulsar-client/
   
   Thank you very much. I used the top command to check the memory usage of the process. After upgrading the version, the memory did not grow anymore


-- 
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


Re: [I] There is a memory leak,I need help [pulsar-client-python]

Posted by "kansnow (via GitHub)" <gi...@apache.org>.
kansnow closed issue #208: There is a memory leak,I need help
URL: https://github.com/apache/pulsar-client-python/issues/208


-- 
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


Re: [I] There is a memory leak,I need help [pulsar-client-python]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat commented on issue #208:
URL: https://github.com/apache/pulsar-client-python/issues/208#issuecomment-2023069648

   Can you try with latest version 3.4.0? https://pypi.org/project/pulsar-client/


-- 
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


Re: [I] There is a memory leak,I need help [pulsar-client-python]

Posted by "kansnow (via GitHub)" <gi...@apache.org>.
kansnow commented on issue #208:
URL: https://github.com/apache/pulsar-client-python/issues/208#issuecomment-2024238645

   > Can you try with latest version 3.4.0? https://pypi.org/project/pulsar-client/
   
   ok, I'll try upgrading the version


-- 
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