SVGHMI: Fix watchdog not cleanly restarting browser because not waiting for stop operation to finish before restarting.
--- a/svghmi/svghmi_server.py Thu Aug 01 12:11:11 2024 +0200
+++ b/svghmi/svghmi_server.py Tue Aug 06 15:25:57 2024 +0200
@@ -310,9 +310,9 @@
def waitpid_timeout_loop(proc = proc, timeout = timeout):
try:
while proc.poll() is None:
- time.sleep(1)
- timeout = timeout - 1
- if not timeout:
+ time.sleep(.1)
+ timeout = timeout - .1
+ if timeout <= 0:
GetPLCObjectSingleton().LogMessage(
LogLevelsDict["WARNING"],
"Timeout waiting for {} PID: {}".format(helpstr, str(proc.pid)))
@@ -320,5 +320,5 @@
except OSError:
# workaround exception "OSError: [Errno 10] No child processes"
pass
- Thread(target=waitpid_timeout_loop, name="Zombie hunter").start()
-
+ waitpid_timeout_loop()
+