linux-automation / lxa-iobus

Linux Automation IOBus server
https://lxa-iobus.readthedocs.io/en/latest/
Apache License 2.0
3 stars 4 forks source link

can rx/tx: Handle bus errors or shutdown service #27

Closed SmithChart closed 2 years ago

SmithChart commented 2 years ago

Until now any error in the CAN-TX thread lead to the thread terminating itself with an debug message. In a case of a CAN bus without any nodes this leads to an IOBus server running without sending any messages on the bus. Also there were no measures in place to recover from this.

With this change the following error is handled:

CanError Failed to transmit: [Errno 105] No buffer space available This error occours if the the messages queued in the socket can not be send, eg. because there is no other device on the bus. This is a common case for the IOBus server and needs to be handled!

If this eror occoured a message is logged as a warning (to inform the user that something is wrong) once. The message triggering the error is discarded. If the bus recovers from this error another message is logged.

All errors from which we can not recover now lead to a sys.exit(1). All other errors (from which we can not recover) lead to the application terminating.