hardbyte / hardbyte/python-can

Graceful exception handling in Notifier thread

Abierto
#907 7 comentarios 0 reacciones 0 asignados Ver en GitHub
backend:iscan bug
Lenguaje dominante
Python
Estrellas
1.6k
Forks
697
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

The notifier module does not handle exceptions well. Some drivers (in this case) throw an exception if there is no other participant on the bus yet (messages are not ACKed) which effectively kills the listener thread of the Notifier class. If asyncio is used (loop=valid object) this leads to a gap and possible messages are lost.

A list of errors to be suppressed should be added to the Notifier class, enabling the user to disable certain errors. Alternatively, (at least) the iscan module needs to be rewritten not to forward any errors.

The following workaround is in place here:

```
class Notifier(can.Notifier):
def _rx_thread(self, bus):
while self._running:
try:
super()._rx_thread(bus)
except can.interfaces.iscan.IscanError:
pass
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.