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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。