Skip to content

flake: Data race in derphealth - TestDERP #1505

@flake-investigator

Description

@flake-investigator

CI Run Link: https://github.com/coder/coder/actions/runs/25064499796
Failing Job: https://github.com/coder/coder/actions/runs/25064499796/job/73427821848 (test-go-race-pg)
Commit: 3f0e015fe53dca6172ebf31feafa30756ae980f8 (George K) coder/coder@3f0e015

Failure summary:

  • coderd/healthcheck/derphealth TestDERP subtests (STUNOnly/NoStun, NoDERP/EmptyMap, STUNOnly/WarnsNoDERP, STUNOnly/OneBadOneGood) failed with race detector output.
  • testing.go:1617: race detected during execution of test

Race detection evidence:

WARNING: DATA RACE
Read at 0x00c0004aca28 by goroutine 257:
  github.com/coder/coder/v2/coderd/healthcheck/derphealth.(*Report).Run.func1()
      /home/runner/work/coder/coder/coderd/healthcheck/derphealth/derp.go:112 +0x24b

Previous write at 0x00c0004aca28 by goroutine 36:
  github.com/coder/coder/v2/coderd/healthcheck/derphealth.(*Report).Run()
      /home/runner/work/coder/coder/coderd/healthcheck/derphealth/derp.go:118 +0x7f8
  github.com/coder/coder/v2/coderd/healthcheck/derphealth_test.TestDERP.func7()
      /home/runner/work/coder/coder/coderd/healthcheck/derphealth/derp_test.go:392 +0x4aa

Root cause assessment:

  • Data race in coderd/healthcheck/derphealth.Report.Run between the goroutine that appends to r.Warnings under the local mutex and the main goroutine that appends the no DERP nodes warning without holding the same lock when !hasDERP.
  • Likely introduced by the recent change adding the no-DERP warning in derp.go.

Assignment analysis:

  • Targeted blame (not available via current tooling):
    • git blame -L 106,118 coderd/healthcheck/derphealth/derp.go
    • git blame -L 367,410 coderd/healthcheck/derphealth/derp_test.go
  • github_list_commits for coderd/healthcheck/derphealth/derp.go and derp_test.go shows the most recent meaningful change is commit 3f0e015fe53d (George K), which added the no-DERP warning and touched TestDERP.
  • Unable to map George K to a GitHub username via the API; assigning to @johnstcn as a long-term owner of the derphealth area (multiple recent commits) for triage.

Related issues search (coder/internal):

  • "derphealth" "data race"
  • "TestDERP" "race detected"
  • "WARNING: DATA RACE" derp
  • "STUNOnly" "NoStun"
  • No direct duplicates found.

Reproduction:

  • go test ./coderd/healthcheck/derphealth -run TestDERP -race -count=50

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions