apache / apache/pulsar-client-python

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

オープン
#42 コメント 3 件 リアクション 0 件 担当者 1 名 @zbentley が担当を希望しています GitHub で見る
主要言語
Python
スター
75
フォーク
53
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。