apache / apache/pulsar-client-python

Disposing of a Python Consumer object without calling close() leaks file descriptors and does not close the consumer.

Đang mở
#42 3 bình luận 0 reaction 1 người được giao Được @zbentley nhận Xem trên GitHub
Ngôn ngữ chính
Python
Star
75
Fork
53
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.