apache / apache/pulsar-client-python

`use_tls` and `pulsar+ssl://` client behavior can differ

Aberta
#269 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
75
Forks
53
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

While running Pulsar cluster proxies behind an AWS Load Balancer I ran into issues with TLS connections to the proxies using example code from this repository. Running the `examples/consumer.py` code with the client url set to an LB hostname and `use_tls=True` results in connection failures, whereas simply specifying `pulsar+ssl://` the consumer works as expected. After checking [docs ](https://pulsar.apache.org/api/python/3.8.x/pulsar.Client.html)it seems the `use_tls` argument is deprecated, but I would still expect the behavior between `use_tls` and `pulsar+ssl://` to be the same. I can provide details on the load balancer configuration if needed.

Examples with some logs (fake hostname):
```python
client = pulsar.Client("pulsar://pulsar-primary.acme.org:6651", use_tls=True)
```
This client produces connection errors like below:
```
2025-10-10 12:56:28.815 INFO [0x1f7cd60c0] Client:86 | Subscribing on Topic < redacted_topic >
2025-10-10 12:56:28.815 INFO [0x1f7cd60c0] ClientConnection:193 | [ -> pulsar://pulsar-primary.acme.org:6651] Create ClientConnection, timeout=10000
2025-10-10 12:56:28.815 INFO [0x1f7cd60c0] ConnectionPool:124 | Created connection for pulsar://pulsar-primary.acme.org:6651-pulsar://pulsar-primary.acme.org:6651-0
2025-10-10 12:56:28.875 INFO [0x16cf07000] ClientConnection:410 | [192.168.100.214:65139 -> < redacted_ip >] Connected to broker
2025-10-10 12:56:38.836 ERROR [0x16cf07000] ClientConnection:634 | [192.168.100.214:65139 -> < redacted_ip >] Connection was not established in 10000 ms, close the socket
2025-10-10 12:56:38.837 INFO [0x16cf07000] ClientConnection:1336 | [192.168.100.214:65139 -> < redacted_ip >] Connection disconnected (refCnt: 2)
2025-10-10 12:56:38.837 INFO [0x16cf07000] ConnectionPool:141 | Remove connection for pulsar://pulsar-primary.acme.org:6651-pulsar://pulsar-primary.acme.org:6651-0
2025-10-10 12:56:38.837 INFO [0x16cf07000] RetryableOperation:114 | Reschedule get-partition-metadata-persistent:/< redacted_topic > for 100 ms, remaining time: 29900 ms
2025-10-10 12:56:38.837 INFO [0x16cf07000] ClientConnection:282 | [192.168.100.214:65139 -> < redacted_ip >] Destroyed connection to pulsar://pulsar-primary.acme.org:6651-0
```

After switching the client to use `pulsar+ssl://`, the example consumer code works with no other changes.
```python
client = pulsar.Client("pulsar+ssl://pulsar-primary.acme.org:6651")
```

Is this difference in behavior known and/or expected?

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece com examples/consumer.py e as opções de conexão de pulsar.Client mostradas na issue. Compare o caminho use_tls=True com o caminho da URL pulsar+ssl:// e, em seguida, verifique o comportamento em relação ao argumento obsoleto documentado e à configuração de proxy relatada; o trabalho está concluído quando ambas as formas lidam com o mesmo cenário de conexão TLS ou quando a diferença compatível está claramente documentada.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
distributed-systems
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
38/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.