Fix popen leak and handle perf script crash#993
Merged
Conversation
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
dkorlovs
reviewed
Aug 27, 2025
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
42bb474 to
f7b8694
Compare
Contributor
Author
dkorlovs
previously approved these changes
Sep 1, 2025
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
028461b to
13e3363
Compare
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
6c1246d to
2068415
Compare
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
3617aaa to
f67374b
Compare
because it can cause double subprocess communicate calls Signed-off-by: Min Lim <min.yeol.lim@intel.com>
f67374b to
7f016d5
Compare
prashantbytesyntax
left a comment
Contributor
There was a problem hiding this comment.
The fix looks good, there is still memory growth which i think needs handling for runtime profilers and perf output parsing optimization but could be done in future PRs
| wait_event(self._POLL_TIMEOUT, self._profiler_state.stop_event, lambda: os.path.exists(self.output_path)) | ||
| except TimeoutError: | ||
| process.kill() | ||
| cleanup_process_reference(process) |
Contributor
There was a problem hiding this comment.
we probably need clean up on run time profilers too
dkorlovs
approved these changes
Sep 12, 2025
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.

The patch is revised to take care of cleaning up the popen object being still referenced after the associated subprocess gets terminated.
Based on code review, 3 issues are identified:
gprofiler/gprofiler/utils/__init__.py
Line 266 in 63ef435
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots
Checklist: