RDKEMW-20646 : Using Thread::WorkerPool to send the events#322
Open
karuna2git wants to merge 1 commit into
Open
RDKEMW-20646 : Using Thread::WorkerPool to send the events#322karuna2git wants to merge 1 commit into
karuna2git wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent NetworkManager event publishing from blocking (and potentially deadlocking/crashing) caller threads by offloading notification delivery onto Thunder’s default Core::IWorkerPool.
Changes:
- Introduces a worker-pool based event dispatch path (
dispatchEvent+Job) and routes existing NetworkManager notifications through it. - Updates plugin/legacy
.conf.intemplates to use new CMake-configurable*_AUTOSTARTvalues and removes legacy.configtemplates. - Updates the unified plugin targets to build with
CXX_STANDARD 17.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| plugin/NetworkManagerImplementation.h | Adds NMPublishEvents, Job dispatch wrapper, and private dispatch helpers. |
| plugin/NetworkManagerImplementation.cpp | Routes notification callbacks through worker pool; adds Dispatch switch-based fanout and adds LOG_ENTRY_FUNCTION() in multiple methods. |
| plugin/NetworkManager.config | Removed legacy plugin .config template. |
| plugin/NetworkManager.conf.in | Makes autostart configurable via @PLUGIN_NETWORKMANAGER_AUTOSTART@. |
| plugin/CMakeLists.txt | Adds PLUGIN_NETWORKMANAGER_AUTOSTART cache var; bumps unified plugin targets to C++17. |
| legacy/LegacyWiFiManagerAPIs.config | Removed legacy plugin .config template. |
| legacy/LegacyWiFiManagerAPIs.conf.in | Makes autostart configurable via @PLUGIN_LEGACY_WIFI_AUTOSTART@. |
| legacy/LegacyNetworkAPIs.config | Removed legacy plugin .config template. |
| legacy/LegacyNetworkAPIs.conf.in | Makes autostart configurable via @PLUGIN_LEGACY_NW_AUTOSTART@. |
| legacy/CMakeLists.txt | Adds PLUGIN_LEGACY_*_AUTOSTART cache vars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dacaa00 to
e0b4654
Compare
e0b4654 to
98e1a45
Compare
98e1a45 to
8111fe9
Compare
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
8111fe9 to
ebc2f9b
Compare
Comment on lines
+222
to
+226
| class EXTERNAL Job : public Core::IDispatch { | ||
| protected: | ||
| Job(NetworkManagerImplementation *pNWImpl , NMPublishEvents event, JsonObject ¶ms) | ||
| : m_jobNWImpl(pNWImpl) | ||
| , _event(event) |
Comment on lines
+1013
to
1017
| { | ||
| JsonObject parameters; | ||
| parameters.FromString(jsonOfFilterScanResults); | ||
| dispatchEvent(NM_ON_AVAILABLESSIDS, parameters); | ||
| } |
Comment on lines
+747
to
+756
| case NM_ON_AVAILABLESSIDS: | ||
| { | ||
| string jsonOfFilterScanResults; | ||
| parameters.ToString(jsonOfFilterScanResults); | ||
| for (const auto callback : callbacks) { | ||
| callback->onAvailableSSIDs(jsonOfFilterScanResults); | ||
| callback->Release(); | ||
| } | ||
| } | ||
| break; |
| void NetworkManagerImplementation::Dispatch(NMPublishEvents event, const JsonObject ¶meters) | ||
| { | ||
| LOG_ENTRY_FUNCTION(); | ||
| NMLOG_INFO("Posting %d Event\n", event); |
Comment on lines
+1013
to
1017
| { | ||
| JsonObject parameters; | ||
| parameters.FromString(jsonOfFilterScanResults); | ||
| dispatchEvent(NM_ON_AVAILABLESSIDS, parameters); | ||
| } |
Comment on lines
+749
to
+754
| string jsonOfFilterScanResults; | ||
| parameters.ToString(jsonOfFilterScanResults); | ||
| for (const auto callback : callbacks) { | ||
| callback->onAvailableSSIDs(jsonOfFilterScanResults); | ||
| callback->Release(); | ||
| } |
Comment on lines
+222
to
+225
| class EXTERNAL Job : public Core::IDispatch { | ||
| protected: | ||
| Job(NetworkManagerImplementation *pNWImpl , NMPublishEvents event, const JsonObject ¶ms) | ||
| : m_jobNWImpl(pNWImpl) |
Comment on lines
74
to
77
| set_target_properties(${MODULE_NAME} PROPERTIES | ||
| CXX_STANDARD 11 | ||
| CXX_STANDARD 17 | ||
| CXX_STANDARD_REQUIRED YES | ||
| FRAMEWORK FALSE) |
Comment on lines
131
to
134
| set_target_properties(${MODULE_IMPL_NAME} PROPERTIES | ||
| CXX_STANDARD 11 | ||
| CXX_STANDARD 17 | ||
| CXX_STANDARD_REQUIRED YES | ||
| FRAMEWORK FALSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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