Translations:Сторожевой механизм Watchdog в приложении SmartPlayer/1/en
Description of the Situation
The SmartPlayer platform supports the operation of an important Watchdog mechanism designed to monitor the health of the client application. This mechanism ensures that the system, in this case the Windows-based client application, continues operating correctly and does not stop functioning.
What is Watchdog
The Watchdog mechanism is designed to automatically monitor the health of the client application. It tracks the system's state and verifies that it continues to perform the required operations correctly. If the application stops responding, freezes, or fails to send a heartbeat signal, the Watchdog automatically performs a recovery action, such as restarting the SmartPlayer client application.
Original Watchdog Implementation in SmartPlayer
The first implementation of the Watchdog for the Windows client application was a separate application that monitored whether the process had frozen. This application obtained information from the main application by periodically polling its process.
If the application responded to the request, it confirmed that it was functioning correctly and continued operating.
Polling interval: once every 3 seconds.
If no response was received from the client application, the Watchdog waited until the next polling cycle. A new request was sent 5 seconds after the failed attempt. If three consecutive attempts failed, the Watchdog restarted the SmartPlayer client application. As a result, the client application continued operating.
Enhanced Watchdog Implementation in SmartPlayer
The enhanced Watchdog implementation is designed to detect UI freezes in the SmartPlayer client application on Windows.
Previously, the Watchdog monitored only the overall state of the application.
If the application continued running as a process, maintained its connection, and did not terminate unexpectedly, the mechanism considered it operational. However, in rare cases, the application itself could remain running while the QML-based user interface became unresponsive and stopped responding.
To handle this scenario, a separate parallel thread was added to the client application. This thread continuously monitors the state of the UI thread and determines whether the application's interface is responding. If the UI thread remains unresponsive for 30 seconds, the Watchdog detects the UI freeze and performs a graceful restart of the client application. This allows SmartPlayer to recover automatically without requiring user intervention.
Additional Information
If this article does not help you use the functionality as intended or if you still have questions after reading it, you can ask them in the Discussions section at the top of the page.

Additional information is also available on the page Как взаимодействовать пользователю с разделом "Обсуждения".