apache / apache/pulsar-client-python
intermittent (401 unauthorized) issue in python pulsar client version 3.6.1
- Linguagem predominante
- Python
- Estrelas
- 75
- Forks
- 53
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
```
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.
Guia de contribuição
Direção de pesquisa
Comece executando repetidamente o snippet Python fornecido com as versões do cliente 3.6.1 e 3.1.0, comparando o comportamento de autenticação e lookup em torno de pulsar/__init__.py na linha 802 e da requisição /lookup/v2/topic registrada. Rastreie por que a criação repetida de produtores pode receber HTTP 401 depois que o lookup da partição é bem-sucedido. Considera-se concluído quando a reprodução não falhar mais intermitentemente na versão afetada e uma cobertura de regressão tiver sido adicionada, caso o repositório forneça um ponto de entrada de testes adequado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- authentication, distributed-systems
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100