hardbyte / hardbyte/python-can

Graceful exception handling in Notifier thread

未关闭
#907 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
backend:iscan bug
主要语言
Python
星标
1.6k
派生
697
PR 合并指标
30 天内没有已合并 PR

描述

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
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。