Skip to content

fix: loadtest interrupt summary#925

Open
jhkimqd wants to merge 2 commits into
mainfrom
fix/loadtest-interrupt-summary
Open

fix: loadtest interrupt summary#925
jhkimqd wants to merge 2 commits into
mainfrom
fix/loadtest-interrupt-summary

Conversation

@jhkimqd
Copy link
Copy Markdown
Contributor

@jhkimqd jhkimqd commented May 19, 2026

Description

jhkimqd added 2 commits May 19, 2026 15:03
The previous one-shot select inside the spawned goroutine returned early
if loadTestCtx was already cancelled when the goroutine first ran,
leaving errCh empty. The subsequent drain (mainLoopErr = <-errCh) would
then block forever.

Drop the select. mainLoop itself respects ctx and returns promptly on
cancellation, so the goroutine can unconditionally forward its result.
Previously, the LightSummary block lived inside postLoadTest, which was
only reached from the natural-completion path. Three independent defects
caused interrupt/timeout/error runs to exit with no summary at all:

- log.Fatal on a non-nil mainLoop error called os.Exit(1), skipping
  postLoadTest and any deferred cleanup. Ctrl+C-induced ctx cancellation
  could surface as a regular error from in-flight setup RPCs, hitting
  this path and silently killing the summary.
- The --time-limit timeout path returned early before postLoadTest.
- log.Fatal also masked exit codes for genuinely-broken runs.

Move the LightSummary call into a defer at the top of Run, with endTime
captured before postLoadTest so the reported TPS reflects load-generation
duration rather than post-test cleanup (refunds, --summarize receipt
fetches). Drop the timeout early-return so all three exit paths share a
single tail. Replace log.Fatal with log.Error and return the underlying
error so Cobra propagates non-zero exit codes; filter context.Canceled
so SIGINT exits 0.

Also remove the duplicate preconfTracker.Stats() call from the SIGINT
branch — postLoadTest already invokes it.
@sonarqubecloud
Copy link
Copy Markdown

@jhkimqd jhkimqd requested a review from a team May 19, 2026 06:36
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