Open dave-cz opened 4 years ago
you need to have a thread (probably main thread) in your application that read the server state every second. it will fail at any error and then you can disconnect/reconnect. There is no way out with these kind of network applications, we cannot rely on server warning us
@oroulet I understand that there is no way how to server can warn me. I'm finding a solution like "if i lose connection, my program will properly terminate".
I tried the while True
loop in if __name__ == '__main__':
of executed file but it didn't work.
In program with SubHandler
was Traceback written to stderr and not via logger.exception()
in my code as I wrote above.
In program "if a file was changed, load it and set_value()
to OPC" program just stucked with no error or message.
you need to have a thread (probably main thread) in your application that read the server state every second. it will fail at any error and then you can disconnect/reconnect. <
Did you mean this error - opcua.ua.uaerrors._auto.BadServerHalted: "The server has stopped and cannot process any requests."(BadServerHalted) - will automatically kill its thread ?
I have a program with
SubHandler.datachange_notification()
to save data from OPC to InfluxDB. Code here: https://github.com/FreeOpcUa/python-opcua/issues/845#issuecomment-638213121Program is running on Ubuntu server as a service. Sometimes admin restarts OPC server and I get this error:
Program is not working but
systemctl
says "service is active (running)" - program doesn't die. It's a huge problem, I want to let program die and systemctl will restart it. It seems that any Thread in opcua client is still alive.I tried
signal.pause()
(in code linked above),and run my code via
multiprocessing.Process()
without a satisfactory result. I see no option where to handle server errors.