apache / apache/pulsar-client-python

[python client] message properties are not round-trippable

Aberta
#44 3 comentários 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

**Describe the bug**
Properties objects on messages can be set to (and published with) values that cannot be deserialized on the far side.

**To Reproduce**
1. Using the Python client, publish a message on any topic with `properties={'foo': b'\x01-\x00\x97'}`
2. Using a Python consumer, consume that message and attempt to access `message.properties()`.
3. Observe that a `UnicodeDecodeError` is raised.
4. Repeat steps 1-3 with `properties={ b'\x01-\x00\x97': 'foo'}`

**Expected behavior**
Properties should be round-trippable: they should be deserialized with the same types and values with which they were set, and should not raise exceptions on deserialization.

There are three possible solutions here:
1. Require that all properties keys and values be `bytes`s in Python. This is easy to implement inside the client, but breaks backwards compatibility.
1. Encode type information along with property keys and values. This is harder to implement inside the client (it doesn't seem like it's using `google.protobuf.Value`s on the wire at the moment, but I may be misreading the code) and deserialize the appropriate types in the consumer.
1. Less preferable: require that all keys and values be `str`s in Python. This is more restrictive than the protocol allows, but is probably simpler to implement.

**Environment:**
MacOS 12 x86, Pulsar standalone 2.10, pulsar client 2.10, Python 3.7.13.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece rastreando os caminhos de serialização e desserialização da message property do cliente Python, usando as chaves e os valores representados por bytes na reprodução como o primeiro caso que falha. Compare o comportamento do produtor e do consumidor e determine como a compatibilidade deve ser preservada; considera-se concluído quando ambos os exemplos fazem um round-trip com seus tipos e valores originais sem gerar UnicodeDecodeError.

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
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

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