fix(test): fix TestBlockPoolMaliciousNode DATA RACE (backport #4636)#4640
Merged
fix(test): fix TestBlockPoolMaliciousNode DATA RACE (backport #4636)#4640
Conversation
follow up to #4633 See https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504 <details> <summary>DATA RACE</summary> ================== WARNING: DATA RACE Write at 0x00c00028f110 by goroutine 507: runtime.mapassign_faststr() /opt/hostedtoolcache/go/1.23.1/x64/src/runtime/map_faststr.go:223 +0x0 github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).banPeer() /home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:433 +0x16f github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).RemovePeerAndRedoAllPeerRequests() /home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:266 +0x192 github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode.func4() /home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:353 +0x1ee Previous read at 0x00c00028f110 by goroutine 501: runtime.mapaccess1_faststr() /opt/hostedtoolcache/go/1.23.1/x64/src/runtime/map_faststr.go:13 +0x0 github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).isPeerBanned() /home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:428 +0x128c github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode() /home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:381 +0x1[20](https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504#step:6:21)5 testing.tRunner() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x226 testing.(*T).Run.gowrap1() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x44 Goroutine 507 (running) created at: github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode() /home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:341 +0xdc4 testing.tRunner() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x226 testing.(*T).Run.gowrap1() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x44 Goroutine 501 (running) created at: testing.(*T).Run() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x825 testing.runTests.func1() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:[21](https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504#step:6:22)68 +0x85 testing.tRunner() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x[22](https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504#step:6:23)6 testing.runTests() /opt/hostedtoolcache/go/1.[23](https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504#step:6:24).1/x64/src/testing/testing.go:2166 +0x8be testing.(*M).Run() /opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:2034 +0xf17 main.main() _testmain.go:83 + </details> (cherry picked from commit 2b1db1c)
melekes
approved these changes
Dec 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
follow up to #4633
See https://github.com/cometbft/cometbft/actions/runs/12247740137/job/34188217504
DATA RACE
==================
WARNING: DATA RACE
Write at 0x00c00028f110 by goroutine 507:
runtime.mapassign_faststr()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/map_faststr.go:223 +0x0
github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).banPeer()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:433 +0x16f
github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).RemovePeerAndRedoAllPeerRequests()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:266 +0x192
github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode.func4()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:353 +0x1ee
Previous read at 0x00c00028f110 by goroutine 501:
runtime.mapaccess1_faststr()
/opt/hostedtoolcache/go/1.23.1/x64/src/runtime/map_faststr.go:13 +0x0
github.com/cometbft/cometbft/internal/blocksync.(*BlockPool).isPeerBanned()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool.go:428 +0x128c
github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:381 +0x1205
testing.tRunner()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x226
testing.(*T).Run.gowrap1()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x44
Goroutine 507 (running) created at:
github.com/cometbft/cometbft/internal/blocksync.TestBlockPoolMaliciousNode()
/home/runner/work/cometbft/cometbft/internal/blocksync/pool_test.go:341 +0xdc4
testing.tRunner()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x226
testing.(*T).Run.gowrap1()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x44
Goroutine 501 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1743 +0x825
testing.runTests.func1()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:2168 +0x85
testing.tRunner()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:1690 +0x226
testing.runTests()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:2166 +0x8be
testing.(*M).Run()
/opt/hostedtoolcache/go/1.23.1/x64/src/testing/testing.go:2034 +0xf17
main.main()
_testmain.go:83 +
This is an automatic backport of pull request #4636 done by [Mergify](https://mergify.com).