Skip to content

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

Open
karuna2git wants to merge 1 commit into
developfrom
topic/RDKEMW-20646
Open

RDKEMW-20646 : Using Thread::WorkerPool to send the events#320
karuna2git wants to merge 1 commit 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 [email protected]

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 <[email protected]>
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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants