apache / apache/pulsar-client-python

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

Ouverte
#258 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
75
Forks
53
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.