Adjust windows sensors initialization#21374
Merged
stelfrag merged 2 commits intonetdata:masterfrom Dec 1, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="src/collectors/windows.plugin/GetSensors.c">
<violation number="1" location="src/collectors/windows.plugin/GetSensors.c:635">
P2: `CoUninitialize()` is invoked even when this thread never successfully called `CoInitializeEx()` (e.g., when it returned `RPC_E_CHANGED_MODE`), which can unbalance COM initialization and break subsequent COM calls on the sensor thread.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
thiagoftsm
reviewed
Dec 1, 2025
thiagoftsm
approved these changes
Dec 1, 2025
Contributor
thiagoftsm
left a comment
There was a problem hiding this comment.
After last commits, all 11 sensors on my laptop are having charts. LGTM!
Merged
stelfrag
added a commit
to stelfrag/netdata
that referenced
this pull request
Dec 1, 2025
* Chaneg sensor initialization to handle COM setup in the sensor thread * Fix COM initialization handling in sensor thread (cherry picked from commit a87d38e)
Ferroin
pushed a commit
that referenced
this pull request
Dec 3, 2025
* Chaneg sensor initialization to handle COM setup in the sensor thread * Fix COM initialization handling in sensor thread (cherry picked from commit a87d38e)
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.
Summary
Summary by cubic
Moved COM and Sensor API initialization to the sensors thread to respect COM’s per-thread model and prevent initialization errors. This stabilizes Windows sensors collection and ensures proper cleanup.
Written for commit 2b45c4f. Summary will update automatically on new commits.