RDKEMW-20646 : Using Thread::WorkerPool to send the events#320
Open
karuna2git wants to merge 1 commit into
Open
RDKEMW-20646 : Using Thread::WorkerPool to send the events#320karuna2git wants to merge 1 commit into
karuna2git wants to merge 1 commit into
Conversation
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]>
Contributor
There was a problem hiding this comment.
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
Joband adispatchEvent()/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.inautostart 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 ¶ms) | ||
| : 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: |
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 [email protected]