-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Adjust windows sensors initialization #21374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After last commits, all 11 sensors on my laptop are having charts. LGTM!
* Chaneg sensor initialization to handle COM setup in the sensor thread * Fix COM initialization handling in sensor thread (cherry picked from commit a87d38e)
* Chaneg sensor initialization to handle COM setup in the sensor thread * Fix COM initialization handling in sensor thread (cherry picked from commit a87d38e)
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.