Skip to content

Conversation

@harp-intel
Copy link
Contributor

On rare occasions, perfspect metrics will fail to exit when a workload specified on the command line exits.

Example:
perfspect metrics -- stress-ng --cpu 4 --timeout 20

The functional change made in this PR is to drain the unbuffered channel that receives stdout as it could become blocked if stress-ng (as above) writes to stdout, which might prevent the processes from exiting cleanly. It's a theory at this point, as the issue is intermittent.

@harp-intel harp-intel requested a review from Copilot December 27, 2025 03:03
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 addresses an intermittent issue where the perfspect metrics command fails to exit when a workload specified on the command line completes. The root cause is identified as a potentially blocked unbuffered channel that receives stdout.

Key changes:

  • Added a goroutine to drain the stdout channel to prevent blocking when workloads write to stdout
  • Renamed argsApplication to argsWorkload throughout for consistency
  • Updated user-facing messages to reflect "workload" terminology

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/metrics/perf.go Renamed argsApplication to argsWorkload and cleaned up commented code
cmd/metrics/metrics.go Added stdout draining goroutine, renamed application terminology to workload, and updated validation messages and user prompts

@harp-intel harp-intel merged commit bd87f4c into main Dec 27, 2025
5 checks passed
@harp-intel harp-intel deleted the metrics_workload_no_exit branch December 27, 2025 11:15
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