Skip to content

Conversation

@thiagoftsm
Copy link
Contributor

@thiagoftsm thiagoftsm commented Dec 10, 2025

Summary

This is the first PR addressing potential issues with the Windows plugin on some operating systems.

Test Plan
  1. Compile this branch.
  2. Install it on a Windows host. All modified charts should be present.
Additional Information
For users: How does this change affect me?

Summary by cubic

Stabilizes Windows hardware collection by fixing CPU temp chart setup, safer sensor GUID handling, battery enumeration/capacity reporting, and service status error handling. Improves stability, prevents memory issues, and corrects a user-facing label.

  • Bug Fixes
    • GetHardwareInfo: remove unused update_every, start thread with NULL, fix "Celsius", correct loop/index types and snprintf formats, clearer join error message.
    • GetPowerSupply: enumerate batteries by index, handle missing BatteryTag properly, guard divide-by-zero in capacity, free and reassign name/filename safely.
    • GetSensors: increase GUID buffer size, add safe CLSID-to-string conversion with length checks, release COM objects on failures, use bounded writes for sensor IDs.
    • GetServicesStatus: add robust error handling for service enumeration, safe buffer alloc/realloc, and proper heap free.

Written for commit 3af3a6a. Summary will update automatically on new commits.

@github-actions github-actions bot added area/collectors Everything related to data collection collectors/windows labels Dec 10, 2025
@thiagoftsm thiagoftsm marked this pull request as ready for review December 11, 2025 00:53
@thiagoftsm thiagoftsm requested a review from stelfrag December 11, 2025 00:53
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/collectors/windows.plugin/GetPowerSupply.c">

<violation number="1" location="src/collectors/windows.plugin/GetPowerSupply.c:43">
P1: Capacity calculation has inverted operands. This computes `FullChargedCapacity / Capacity` instead of `Capacity / FullChargedCapacity`, producing incorrect percentages (e.g., 50% battery shows as 200%).</violation>
</file>

<file name="src/collectors/windows.plugin/GetSensors.c">

<violation number="1" location="src/collectors/windows.plugin/GetSensors.c:577">
P2: Return value of `netdata_clsid_to_char` is not checked. If conversion fails, an empty string will be used as the dictionary key, potentially causing multiple sensors to collide on the same key.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@thiagoftsm thiagoftsm merged commit 9b023c3 into netdata:master Dec 11, 2025
118 checks passed
@stelfrag stelfrag mentioned this pull request Dec 11, 2025
stelfrag pushed a commit to stelfrag/netdata that referenced this pull request Dec 11, 2025
Ferroin pushed a commit that referenced this pull request Dec 15, 2025
@thiagoftsm thiagoftsm deleted the fixes branch December 18, 2025 23:15
@thiagoftsm thiagoftsm restored the fixes branch December 18, 2025 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection collectors/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants