Skip to content

fix(generators): own backoff timing in the worker to fix ExponentialBackOff data race (PIPE-1222) - #269

Open
Dylan-M wants to merge 1 commit into
mainfrom
dylanmyers/pipe-1222-data-race-exponentialbackoff
Open

fix(generators): own backoff timing in the worker to fix ExponentialBackOff data race (PIPE-1222)#269
Dylan-M wants to merge 1 commit into
mainfrom
dylanmyers/pipe-1222-data-race-exponentialbackoff

Conversation

@Dylan-M

@Dylan-M Dylan-M commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Proposed Change

Every generator built its send loop with backoff.NewTicker(backoffConfig) and also called backoffConfig.Reset() from the worker goroutine. NewTicker runs its own goroutine that repeatedly calls NextBackOff(), so two goroutines mutated one backoff.ExponentialBackOff, which is not safe for concurrent use. That is a data race on the backoff's interval state.

This drops backoff.NewTicker and drives the interval from a time.Timer owned by the worker. Only the worker calls NextBackOff() and Reset() now, so the backoff state has a single owner. Emission cadence and the reset-on-success behavior are unchanged.

Applied to all 12 generators that shared the pattern: json, apache, apache_combined, apache_error, nginx, filegen, okta, paloalto, postgres, kubernetes, wel, winevt.

How to validate
  • Automated: go test -race ./generator/... passes. Those suites were the failing signal before this change (they reported the Reset() vs NextBackOff() race under -race).
  • Manual: run a generator against main and this branch (e.g. blitz --config <json config>) and confirm the output cadence is unchanged.
Checklist
  • Changes are tested
  • CI has passed

…ponentialBackOff data race (PIPE-1222)

Assisted-by: Claude Opus 4.8
@Dylan-M
Dylan-M requested review from a team as code owners August 3, 2026 13:10
@Dylan-M Dylan-M changed the title fix(generators): own backoff timing in the worker goroutine to fix ExponentialBackOff data race (PIPE-1222) fix(generators): own backoff timing in the worker to fix ExponentialBackOff data race (PIPE-1222) Aug 3, 2026
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.

1 participant