How can I better detect and handle server errors #2804
Unanswered
stormyweathers
asked this question in
Help
Replies: 1 comment 1 reply
-
|
First of all you should update to the newest version of pymodbus, we have made a number of bug fixes regarding stray exception. The stack trace you show would normally be passed to the application, however data exchange runs in another task (due to asyncio) and thus are not always returned to the application (which is one the items we tried to do better in newer versions). the only option I see is to write your own log handler, because some exception originate in asyncio and thus is outside control. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Jan,
First off, thanks for your work in maintaining this library. The code and extensive discussions around it have been very helpful to me over the last year.
[Pymodbus 3.8.6]
Lately, I've been developing a modbus server device, and encountered issues when trying to use it on a multi-drop bus. I encountered Issue #2556, where you mentioned this is not supported behavior. Ok, I think I understand why this would be hard to support, and I have since moved my server to a dedicated network to avoid this issue.
However, this error did not cause my program to crash, instead I only noticed by the stacktrace printed in the logs, and then my server refusing communication afterwards.
I am concerned that some other future error could silently break my program.
But since the exception is handled somewhere deep (perhaps the asyncio library, perhaps pymodbus?), I am unable to handle it myself.
I am starting the server using an adaptation of one of the examples:
where
mfchas a method:Could you offer some advice on this?
One option would be to add a special logging handler to detect this issue, i.e.:
This feels wrong to me, but I don't know a better way.
I'd rather "un-handle" the exception, so the program crashes, and can then be restarted,
Beta Was this translation helpful? Give feedback.
All reactions