Skip to content

Conversation

@harp-intel
Copy link
Contributor

@harp-intel harp-intel commented Jan 8, 2026

This pull request improves the robustness and clarity of the signal handling logic for cleaning up controller processes in the workflow package. The main changes focus on better error handling, concurrent cleanup of target controllers, and clearer logging.

Signal handling and cleanup improvements:

  • Refactored the signal handler to concurrently send SIGINT to all target controller processes and wait for their exit using goroutines and a sync.WaitGroup, improving efficiency and ensuring all controllers are properly cleaned up. [1] [2]
  • Enhanced error handling when retrieving and parsing controller PID files, including distinguishing between missing files (controller already exited) and other errors, and validating PID values before signaling.
  • Improved process cleanup by sending SIGKILL if a controller does not exit within the timeout, with clearer per-target logging for both normal and error cases.

Logging and code clarity:

  • Updated log messages for consistency and clarity, especially regarding perfspect's child processes and error conditions.
  • Minor variable renaming and code cleanup for readability, such as renaming myPid to perfspectPid.

Imports and dependencies:

  • Added imports for errors, strconv, and sync to support improved error handling and concurrency.

…targets

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot January 8, 2026 23:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the signal handler to improve efficiency when handling multiple remote targets by introducing concurrent processing. Previously, the handler sequentially sent signals to each target and then waited for each controller process to exit one by one. The refactored implementation sends signals to all targets and waits for their controllers to exit concurrently using goroutines and a WaitGroup.

Key Changes

  • Introduced concurrent processing using goroutines and sync.WaitGroup to wait for controller processes to exit in parallel
  • Added PID validation to ensure the retrieved PID is a valid integer before attempting to signal the process
  • Improved error messages for clarity and consistency throughout the signal handler

Copy link
Contributor

Copilot AI commented Jan 8, 2026

@harp-intel I've opened a new pull request, #609, to work on those changes. Once the pull request is ready, I'll request review from you.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel merged commit f284a8d into main Jan 9, 2026
5 checks passed
@harp-intel harp-intel deleted the refactor-signal-handler branch January 9, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants