-
Notifications
You must be signed in to change notification settings - Fork 69
Description
When running gProfiler as a systemd service, we observe two key issues:
- One Profiler trying to profile for the Same Target PID
Issue:
Multiple gProfiler-related processes are created to profile the same target process ID.
Example: Both PyPerf (each from staticx and pyinstaller) may attempt to profile the same Python process, leading to redundant profiler subprocesses and increased resource usage. Also noticed 2 subprocesses from gProfiler too ( from staticx installer)
Impact:
Wasted system resources (CPU, memory, file handles)
Potential contention or interference between profiler subprocesses
Harder to reason about profiling results and system load
- Resource Cleanup: Ensure Profiler Subprocesses Are Properly Killed
Feature Request:
Each profiler subprocess (Java, Python, perf, etc.) is launched with a timeout and kill signal (SIGKILL/SIGTERM). However, we want an additional safety check to guarantee that all profiler subprocesses are actually terminated after each profiling duration.
Proposal:
After each profiling interval, use psutil to check for any lingering profiler subprocesses (e.g., py-spy, async-profiler, perf) that should have exited.
If any are found, forcibly terminate them using psutil.Process(pid).kill() and log the action.
Optionally, add a summary log or metric for "zombie" profiler subprocesses cleaned up in this way.
- Multiple process of gProfiler spun up from staticx installer
- Two profilers trying to profiler same target process