Gosigar's WMI/COM library is leaking memory under Windows #12703
Labels
bug
help wanted
Indicates that a maintainer wants help on an issue or pull request
Metricbeat
Metricbeat
Team:Integrations
Label for the Integrations team
Gosigar internally uses WMI to fetch some process information under Windows. The use of WMI requires initializing the COM library (CoInitializeEx) on each system thread that is going to use it.
Currently, this happens inside github.com/StackExchange/wmi which calls CoInitializeEx/CoUninitialize for each WMI query.
However, I've found out that each call to CoInitializeEx leaks some memory:
The leak stopped by performing this initialization only once per thread:
However, I'm not 100% sure that code is safe as there is no matching CoUninitialize call anymore.
We should either improve that code or migrate uses of gosigar to go-sysinfo which does not use WMI.
This currently affects Metricbeat's system/process, system/diskio and logging.metrics reporting every 30s.
The text was updated successfully, but these errors were encountered: