Skip to content

tests: fix TestNodeSetCatchpointCatchupMode data race#6574

Merged
algorandskiy merged 1 commit intoalgorand:masterfrom
algorandskiy:pavel/test-fixes-0304
Mar 10, 2026
Merged

tests: fix TestNodeSetCatchpointCatchupMode data race#6574
algorandskiy merged 1 commit intoalgorand:masterfrom
algorandskiy:pavel/test-fixes-0304

Conversation

@algorandskiy
Copy link
Copy Markdown
Contributor

Summary

Fixed a data race as seen here:

WARNING: DATA RACE
Write at 0x00c02383dea8 by goroutine 12204:
  runtime.racewrite()
      <autogenerated>:1 +0x1e
  github.com/algorand/go-algorand/node.(*AlgorandFullNode).waitMonitoringRoutines()
      /home/runner/work/go-algorand/go-algorand/node/node.go:470 +0x1db
  github.com/algorand/go-algorand/node.(*AlgorandFullNode).SetCatchpointCatchupMode.func1.1()
      /home/runner/work/go-algorand/go-algorand/node/node.go:1269 +0x4e
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.25.3/x64/src/runtime/panic.go:589 +0x5d

Previous read at 0x00c02383dea8 by goroutine 12232:
  runtime.raceread()
      <autogenerated>:1 +0x1e
  github.com/algorand/go-algorand/node.(*AlgorandFullNode).startMonitoringRoutines()
      /home/runner/work/go-algorand/go-algorand/node/node.go:454 +0x94
  github.com/algorand/go-algorand/node.(*AlgorandFullNode).SetCatchpointCatchupMode.func1()
      /home/runner/work/go-algorand/go-algorand/node/node.go:1307 +0x7d1

What happens is enable=true call stops goroutines but unblocks the caller waiting on <-outCh earlier then it actually completes, allowing the caller to call SetCatchpointCatchupMode. Rarely it these two goroutines race on WaitGroup's Add and Wait methods.

Test Plan

Run locally go test ./node -race -run TestNodeSetCatchpointCatchupMode -count=100 (same as before the fix, no repro).

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.82%. Comparing base (8d84b18) to head (4c1083f).
⚠️ Report is 4 commits behind head on master.
✅ All tests successful. No failed tests found.

❗ There is a different number of reports uploaded between BASE (8d84b18) and HEAD (4c1083f). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (8d84b18) HEAD (4c1083f)
full_coverage 4 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6574       +/-   ##
===========================================
- Coverage   63.60%   47.82%   -15.78%     
===========================================
  Files         486      646      +160     
  Lines       67806    89431    +21625     
===========================================
- Hits        43125    42767      -358     
- Misses      21188    43852    +22664     
+ Partials     3493     2812      -681     
Flag Coverage Δ
full_coverage ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gmalouf gmalouf closed this Mar 5, 2026
@gmalouf gmalouf reopened this Mar 5, 2026
@algorandskiy algorandskiy reopened this Mar 6, 2026
@algorandskiy algorandskiy merged commit 72220dd into algorand:master Mar 10, 2026
143 of 159 checks passed
@algorandskiy algorandskiy deleted the pavel/test-fixes-0304 branch March 16, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants