hardbyte / hardbyte/python-can

Graceful exception handling in Notifier thread

Đang mở
#907 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
backend:iscan bug
Ngôn ngữ chính
Python
Star
1.6k
Fork
697
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.