danielgtaylor / danielgtaylor/python-betterproto

Encoding errors while sending aren't thrown because the sending task is started as fire and forget

Abierto
#188 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
1.8k
Forks
234
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hey there,

I've incorrectly passed a string instead of a message to a grpc field. This will result in an exception which is thrown during encoding in the `__bytes__` method (https://github.com/danielgtaylor/python-betterproto/blob/master/src/betterproto/__init__.py#L634). This method throws an exception that it cannot encode a string as a message.

However the user never sees the exception, because the sending task is started as fire and forget, without handling the exception case. This will result in hidden exceptions. The user only notices that the program doesn't work as expected or it feels like the program has hung up:
```python
sending_task = asyncio.ensure_future(
self._send_messages(stream, request_iterator)
)
```
https://github.com/danielgtaylor/python-betterproto/blob/master/src/betterproto/grpc/grpclib_client.py#L153

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en src/betterproto/grpc/grpclib_client.py, en la llamada a ensure_future alrededor de la línea 153, y luego inspecciona _send_messages y el método __bytes__ en src/betterproto/__init__.py. Reproduce el caso no válido de conversión de una cadena a un mensaje y sigue el ciclo de vida de la tarea; se considera terminado cuando la excepción de codificación es observable para el llamador en lugar de permanecer oculta.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
grpc, python
Área
api, backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.