Skip to content

fix(test): fix TestBlockPoolMaliciousNode DATA RACE (backport #4636)#4640

Merged
melekes merged 1 commit intov1.xfrom
mergify/bp/v1.x/pr-4636
Dec 11, 2024
Merged

fix(test): fix TestBlockPoolMaliciousNode DATA RACE (backport #4636)#4640
melekes merged 1 commit intov1.xfrom
mergify/bp/v1.x/pr-4636

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Dec 10, 2024

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).

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)
@mergify mergify bot requested a review from a team as a code owner December 10, 2024 12:16
@mergify mergify bot requested a review from a team December 10, 2024 12:16
@melekes melekes merged commit 25128b2 into v1.x Dec 11, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-4636 branch December 11, 2024 06:05
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