apache / apache/pulsar-client-python

intermittent (401 unauthorized) issue in python pulsar client version 3.6.1

未關閉
#258 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
75
分支
53
PR 合併指標
30 天內沒有已合併 PR

描述

```
2025-05-27 10:04:07.122 INFO [0x16cf1f000] HTTPLookupService:223 | Curl Lookup Request sent for http://11.22.22.11:80/admin/v2/persistent/test/basicTests/testProduce/partitions?checkAllowAutoCreation=true
2025-05-27 10:04:08.574 INFO [0x16cf1f000] HTTPLookupService:239 | Response received for url http://11.22.22.11:80/admin/v2/persistent/test/basicTests/testProduce/partitions?checkAllowAutoCreation=true responseCode 200
2025-05-27 10:04:08.574 INFO [0x16cf1f000] HTTPLookupService:280 | parsePartitionData = { LookupDataResult [brokerUrl_ = ] [brokerUrlTls_ = ] [partitions = 1] [authoritative = 0] [redirect = 0] proxyThroughServiceUrl = 0] }
2025-05-27 10:04:08.575 INFO [0x16cf1f000] HandlerBase:115 | [persistent://test/basicTests/testProduce-partition-0, ] Getting connection from pool
2025-05-27 10:04:08.575 INFO [0x16cf1f000] HTTPLookupService:223 | Curl Lookup Request sent for http://11.22.22.11:80/lookup/v2/topic/persistent/test/basicTests/testProduce-partition-0
2025-05-27 10:04:09.475 ERROR [0x16cf1f000] HTTPLookupService:246 | Response failed for url http://11.22.22.11:80/lookup/v2/topic/persistent/test/basicTests/testProduce-partition-0: HTTP response code said error, curl error: The requested URL returned error: 401
2025-05-27 10:04:09.476 ERROR [0x16cf1f000] PartitionedProducerImpl:168 | Unable to create Producer for partition - 0 Error - ConnectError
2025-05-27 10:04:09.476 INFO [0x16cf1f000] ProducerImpl:800 | [persistent://test/basicTests/testProduce-partition-0, ] Closing producer for topic persistent://test/basicTests/testProduce-partition-0
2025-05-27 10:04:09.477 INFO [0x16cf1f000] ProducerImpl:764 | [persistent://test/basicTests/testProduce-partition-0, ] Closed producer 0
2025-05-27 10:04:09.477 INFO [0x16cf1f000] ProducerImpl:757 | Producer - [persistent://test/basicTests/testProduce-partition-0, ] , [batching = off]
Traceback (most recent call last):
File "/Users/abc/Desktop/pythonproj/basic.py", line 13, in
producer = client.create_producer("persistent://test/basicTests/testProduce")
File "/Users/abc/Desktop/pythonproj/.venv/lib/python3.9/site-packages/pulsar/__init__.py", line 802, in create_producer
p._producer = self._client.create_producer(topic, conf)
_pulsar.ConnectError: Pulsar error: ConnectError
```

I am using this simple code snippet:
```
from pulsar import Client, AuthenticationOauth2

params = '''
{
"client_id": "my-client",
"client_secret": "my-secret",
"issuer_url": "my-auth-url",
"audience": "my-audience",
}
'''

client = Client("http://11.22.22.11:80", authentication=AuthenticationOauth2(params))
producer = client.create_producer("persistent://test/basicTests/testProduce")
producer.send(('my-msg').encode('utf-8'))
client.close()
```

If I change the pulsar python client version to 3.1.0, then there is no issue.
To reproduce the issue, run the above code snippet mutilple time quickly.

貢獻指南

開啟貢獻指南

研究方向

首先,使用用戶端版本 3.6.1 和 3.1.0 反覆執行提供的 Python 程式碼片段,比較 pulsar/__init__.py 第 802 行附近的驗證和查找行為,以及記錄的 /lookup/v2/topic 請求。追蹤為什麼在分割區查找成功後,重複建立 producer 仍可能收到 HTTP 401。完成的標準是:在受影響的版本上,該重現不再間歇性失敗;如果儲存庫提供了合適的測試入口點,還應新增回歸測試涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
authentication, distributed-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。