Skip to content

[SharovBot] fix: eliminate data race in FilesItem.closeFilesAndRemove / Decompressor.Close - #21453

Closed
erigon-copilot[bot] wants to merge 1 commit into
mainfrom
erigon-copilot/fix-data-race-closefilesandremove
Closed

erigon-copilot[bot] wants to merge 1 commit into
mainfrom
erigon-copilot/fix-data-race-closefilesandremove

Conversation

@erigon-copilot

Copy link
Copy Markdown
Contributor

Summary

  • Fix DATA RACE in TestHistoryVerification_SimpleBlocks caused by concurrent calls to FilesItem.closeFilesAndRemove() on the same item from multiple goroutines via the reclamation path
  • Wrap FilesItem.closeFilesAndRemove() with sync.Once (closeAndRemove field) to guarantee the close-and-remove logic executes at most once
  • Wrap Decompressor.Close() with sync.Once (closeOnce field) for defense-in-depth against concurrent close of the same decompressor

Test plan

  • go test -race -count=5 -run TestHistoryVerification_SimpleBlocks ./execution/verify/... passes with no DATA RACE
  • go build ./... passes
  • No test files modified

🤖 Generated with Claude Code

…sor.Close

Two goroutines could concurrently call closeFilesAndRemove on the same
FilesItem via the reclamation path, racing on nil-pointer fields and
Decompressor internal state. Wrap both closeFilesAndRemove and
Decompressor.Close with sync.Once to guarantee at-most-once execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
@AskAlexSharov

Copy link
Copy Markdown
Collaborator

fixed by #21397

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