-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Change WMISampler class to create a single thread, owned by the object #3987
Conversation
that always does the WMI queries. Only call CoInitialize once. Attempt to not trigger apparent bug in win2016 which causes a memory leak.
Not a full review, but as a general design comment I'd rather not inherit from Thread, and keep the class hierarchy as-is. |
self._current_sample = self._query() | ||
|
||
self._previous_sample = self._current_sample | ||
self._current_sample = self._query() |
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.
Unless I'm being daft, self._query
is never defined
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.
I think it is defined here on line 433
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.
Ah ty, I was misreading the deletion on line 145
50cd0f6
to
82bfb7a
Compare
Fix import order
82bfb7a
to
91114ba
Compare
…t, (#3987) * Change WMISampler class to create a single thread, owned by the object, that always does the WMI queries. Only call CoInitialize once. Attempt to not trigger apparent bug in win2016 which causes a memory leak. * Fix improper initializaiton of `_sampling` Fix import order
What does this PR do?
Changes the implementation behavior or the WMISampler class, used to do WMI requests.
Old version created a new thread for each request, which in turn required CoInitialize() on that
new thread. This behavior apparently triggers a memory leak in win2016.
New implementation creates a single thread per WMISampler object instance. That thread just waits to be signaled, and when it does, it runs the WMI query. By doing this we
Motivation
Memory leak detected in agent core process
Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached