From 5b36bf3d45dbad4f28642ea8ffb58435cf5e2fa5 Mon Sep 17 00:00:00 2001 From: tabbas651 <74683978+tabbas651@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:23:16 -0400 Subject: [PATCH] RDKTV-30997, RDKTV-31062 : Re-activate after 5s when monitored plugin crashes (#5473) In the Thunder R4 releases, 1.The lifetime of the plugin status must be learned by ILifeTime notification. 2.The current state machine posts only Activated and Deactivated event. 3.Also, the Deactivated event is posted to all the listeners to give-up the subscription n other things before unloading the plugin library from the execution context. 4.The internal state of plugin managed by Thunder is set to DEACTIVATION and then notifies the clients as mentioned above and finally when dlclose() is done, it sets the state to DEACTIVATED. 5.Meanwhile when Monitor plugin calls ACTIVATE by getting the statechange notification as part of (3) where as the internal state is still DEACTIVATION. 6.This activate request will fail as the unloading of library is still in process. 7.The Monitor plugin must be updated to use ILifeTime or Thunder core has to be updated to use proper eventing. 8.But until then, we can update the Monitor to call activate after 5s when it receives deactivated notification. Test Procedure: Verified in Jenkins Build Risks: High Signed-off-by: Thamim Razith --- Monitor/CHANGELOG.md | 4 ++++ Monitor/Monitor.cpp | 2 +- Monitor/Monitor.h | 2 +- docs/api/MonitorPlugin.md | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Monitor/CHANGELOG.md b/Monitor/CHANGELOG.md index 3640c4852c..74010f597b 100644 --- a/Monitor/CHANGELOG.md +++ b/Monitor/CHANGELOG.md @@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file. * For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README. +## [1.0.8] - 2024-07-01 +### Changed +- Added Delay in Thread Restart Logic + ## [1.0.7] - 2024-05-31 ### Changed - RDK-45345: Upgrade Sky Glass devices to use Thunder R4.4.1 diff --git a/Monitor/Monitor.cpp b/Monitor/Monitor.cpp index 4a5869c78f..57fec083ee 100644 --- a/Monitor/Monitor.cpp +++ b/Monitor/Monitor.cpp @@ -21,7 +21,7 @@ #define API_VERSION_NUMBER_MAJOR 1 #define API_VERSION_NUMBER_MINOR 0 -#define API_VERSION_NUMBER_PATCH 6 +#define API_VERSION_NUMBER_PATCH 8 namespace WPEFramework { diff --git a/Monitor/Monitor.h b/Monitor/Monitor.h index 0f2c570ff3..148e331f07 100644 --- a/Monitor/Monitor.h +++ b/Monitor/Monitor.h @@ -811,7 +811,7 @@ namespace Plugin { _service->Notify(message); _parent.event_action(callsign, "Activate", "Automatic"); TRACE(Trace::Error, (_T("Restarting %s again because we detected it misbehaved."), callsign.c_str())); - Core::IWorkerPool::Instance().Schedule(Core::Time::Now(), PluginHost::IShell::Job::Create(service, PluginHost::IShell::ACTIVATED, PluginHost::IShell::AUTOMATIC)); + Core::IWorkerPool::Instance().Schedule(Core::Time::Now().Add(5000), PluginHost::IShell::Job::Create(service, PluginHost::IShell::ACTIVATED, PluginHost::IShell::AUTOMATIC)); } } } diff --git a/docs/api/MonitorPlugin.md b/docs/api/MonitorPlugin.md index c84e279e5d..23f1f49a95 100644 --- a/docs/api/MonitorPlugin.md +++ b/docs/api/MonitorPlugin.md @@ -2,7 +2,7 @@ # Monitor Plugin -**Version: [1.0.7](https://github.com/rdkcentral/rdkservices/blob/main/Monitor/CHANGELOG.md)** +**Version: [1.0.8](https://github.com/rdkcentral/rdkservices/blob/main/Monitor/CHANGELOG.md)** A Monitor plugin for Thunder framework.