Skip to content

RDKEMW-20646 : Using Thread::WorkerPool to send the events#320

Closed
karuna2git wants to merge 3 commits into
developfrom
topic/RDKEMW-20646
Closed

RDKEMW-20646 : Using Thread::WorkerPool to send the events#320
karuna2git wants to merge 3 commits into
developfrom
topic/RDKEMW-20646

Conversation

@karuna2git

@karuna2git karuna2git commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Reason for change: All the NetworkManager Events are published from the calling thread context;
somethings are from NMEvent, NMThread, somethings are from Connectivity thread and WiFiQualityMonitoring thread.
When consumer is not responding properly, this will lead to extended lock & Sometimes Gnome NetworkManager Crash. To avoid this, all the events are sent thro Thread::WorkerPool that is default created by the Thunder.

Test Procedure: Verify All the Networking Events
Risks: Medium
Signed-off-by: Karunakaran A karunakaran_amirthalingam@cable.comcast.com

Copilot AI review requested due to automatic review settings June 29, 2026 02:21
@karuna2git karuna2git requested a review from a team as a code owner June 29, 2026 02:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent NetworkManager event publication from running in various caller thread contexts (NM event threads, connectivity thread, WiFi monitoring thread), by offloading notification dispatch to Thunder’s default worker pool to reduce lock contention and avoid GNOME NetworkManager instability.

Changes:

  • Introduces an internal worker-pool Job and a dispatchEvent() / Dispatch() path to publish notification callbacks asynchronously.
  • Adds broad function-entry logging via LOG_ENTRY_FUNCTION() across many APIs and helper paths.
  • Updates plugin/legacy configuration generation to use *.conf.in autostart cache variables and bumps the plugin build to C++17.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
plugin/NetworkManagerLogger.h Changes entry logging macro to include function name and log at INFO.
plugin/NetworkManagerImplementation.h Adds event enum + worker-pool Job dispatcher plumbing.
plugin/NetworkManagerImplementation.cpp Routes notification callbacks through worker pool; adds many entry logs; adjusts event logging.
plugin/NetworkManager.config Removed legacy generated config template.
plugin/NetworkManager.conf.in Makes autostart configurable via CMake cache variable.
plugin/CMakeLists.txt Adds autostart cache variable; bumps C++ standard to 17 for plugin targets.
legacy/LegacyWiFiManagerAPIs.config Removed legacy generated config template.
legacy/LegacyWiFiManagerAPIs.conf.in Makes autostart configurable via CMake cache variable.
legacy/LegacyNetworkAPIs.config Removed legacy generated config template.
legacy/LegacyNetworkAPIs.conf.in Makes autostart configurable via CMake cache variable.
legacy/CMakeLists.txt Adds autostart cache variables for legacy plugins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +730 to +738
case NM_ON_AVAILABLESSIDS:
{
string jsonOfFilterScanResults;
parameters.ToString(jsonOfFilterScanResults);
for (const auto callback : _notificationCallbacks) {
callback->onAvailableSSIDs(jsonOfFilterScanResults);
}
}
break;
Comment on lines +981 to 985
{
JsonObject parameters;
parameters.FromString(jsonOfFilterScanResults);
dispatchEvent(NM_ON_AVAILABLESSIDS, parameters);
}
Comment on lines +224 to 231
Job(NetworkManagerImplementation *NetworkManagerImplementation, NMPublishEvents event, JsonObject &params)
: m_jobNWImpl(NetworkManagerImplementation)
, _event(event)
, _params(params) {
if (m_jobNWImpl != nullptr) {
m_jobNWImpl->AddRef();
}
}
Comment on lines +247 to +249
virtual void Dispatch() {
m_jobNWImpl->Dispatch(_event, _params);
}
#define NMLOG_FATAL(FMT, ...) logPrint(NetworkManagerLogger::FATAL_LEVEL, __FILE__,__func__, __LINE__, FMT, ##__VA_ARGS__)

#define LOG_ENTRY_FUNCTION() { NMLOG_DEBUG("Entering"); }
#define LOG_ENTRY_FUNCTION() { NMLOG_INFO("Entering %s", __func__); }
Comment on lines +687 to +691
NMLOG_INFO("Posting %d Event\n", event);
_notificationLock.Lock();
switch(event)
{
case NM_ON_INTERFACESTATE_CHANGE:
Reason for change: All the NetworkManager Events are published from the calling thread context; somethings are from NMEvent, NMThread, somethings are from Connectivity thread and WiFiQualityMonitoring thread. When consumer is not responding properly, this will lead to extended lock & Sometimes Gnome NetworkManager Crash.
To avoid this, all the events are sent thro Thread::WorkerPool that is default created by the Thunder.
Test Procedure: Verify All the Networking Events
Risks: Medium
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
@karuna2git karuna2git force-pushed the topic/RDKEMW-20646 branch from a4e4f4d to 9f1d8de Compare July 6, 2026 20:47
Anand73-n and others added 2 commits July 6, 2026 20:51
Reason for change: fix deepsleep reconnect failure due to
"wpa_cli status" returning empty BSSID, which cleared last SSID.
Test procedure: WiFi should reconnect on DeepSleep wakeup
Risks: low
Priority: P1

Signed-off-by: Anand N <Anand_N@comcast.com>
)

Reason for change: Fix the notification locks in networkmanager plugin
Priority: P1
Test Procedure: Check the test steps in RDKEMW-20574
Risks: medium

Signed-off-by: jincysaramma_sam@comcast.com
Copilot AI review requested due to automatic review settings July 6, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 13 comments.

#define NMLOG_FATAL(FMT, ...) logPrint(NetworkManagerLogger::FATAL_LEVEL, __FILE__,__func__, __LINE__, FMT, ##__VA_ARGS__)

#define LOG_ENTRY_FUNCTION() { NMLOG_DEBUG("Entering"); }
#define LOG_ENTRY_FUNCTION() { NMLOG_INFO("Entering %s", __func__); }
Comment on lines +224 to +251
Job(NetworkManagerImplementation *NetworkManagerImplementation, NMPublishEvents event, JsonObject &params)
: m_jobNWImpl(NetworkManagerImplementation)
, _event(event)
, _params(params) {
if (m_jobNWImpl != nullptr) {
m_jobNWImpl->AddRef();
}
}
void Dispatch() override
{
_work();

public:
Job() = delete;
Job(const Job&) = delete;
Job& operator=(const Job&) = delete;
~Job() {
if (m_jobNWImpl != nullptr) {
m_jobNWImpl->Release();
}
}

public:
static Core::ProxyType<Core::IDispatch> Create(NetworkManagerImplementation *pNWImpl, NMPublishEvents event, JsonObject params) {
return (Core::ProxyType<Core::IDispatch>(Core::ProxyType<Job>::Create(pNWImpl, event, params)));
}
virtual void Dispatch() {
if (m_jobNWImpl != nullptr) {
m_jobNWImpl->Dispatch(_event, _params);
}
}
void NetworkManagerImplementation::Dispatch(NMPublishEvents event, const JsonObject &parameters)
{
LOG_ENTRY_FUNCTION();
NMLOG_INFO("Posting %d Event\n", event);
Comment on lines +766 to +779
case NM_ON_WIFISIGNALQUALITY_CHANGE:
{
string ssid = parameters["ssid"].String();
Exchange::INetworkManager::WiFiSignalQuality quality = static_cast <Exchange::INetworkManager::WiFiSignalQuality>(parameters["quality"].Number());
int snr = parameters["snr"].Number();
int strength = parameters["strength"].Number();
int noise = parameters["noise"].Number();
for (const auto callback : callbacks) {
callback->onWiFiSignalQualityChange(ssid, strength, noise, snr, quality);
callback->Release();
}
}
break;
}
Comment on lines +843 to +847
{
Core::JSON::EnumType<Exchange::INetworkManager::InterfaceState> iState{state};
JsonObject parameters;
parameters["state"] = JsonValue(state);
parameters["interface"] = interface;
@@ -618,10 +627,10 @@ namespace WPEFramework

double frequencyValue = std::stod(frequency);
Comment on lines +1010 to 1014
{
JsonObject parameters;
parameters.FromString(jsonOfFilterScanResults);
dispatchEvent(NM_ON_AVAILABLESSIDS, parameters);
}
Comment on lines +749 to +750
string jsonOfFilterScanResults;
parameters.ToString(jsonOfFilterScanResults);
Comment on lines +1331 to +1332
JsonObject parameters;
Core::JSON::EnumType<Exchange::INetworkManager::WiFiState> iState{state};
Comment on lines +633 to 636
for (const auto& selectedFrequency : filterFrequencies)
{
if (selectedFrequency == "ALL")
{
@karuna2git karuna2git closed this Jul 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
@karuna2git karuna2git deleted the topic/RDKEMW-20646 branch July 6, 2026 21:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants