Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix race condition when pinging peers #13701

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

qu0b
Copy link
Contributor

@qu0b qu0b commented Mar 7, 2024

What type of PR is this?

Bug fix found using Antithesis

What does this PR do? Why is it needed?

Fixes a race condition where the underlying pingMethod changes while it is being read and vice versa.

WARNING: DATA RACE
Read at #HEX by go routine: #DIG:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p.(*Service).pingPeers()
      beacon-chain/p2p/service.go:361 +0x37
  github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p.(*Service).RefreshENR()
      beacon-chain/p2p/discovery.go:94 +0xa7a
  github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p.(*Service).Start()
      beacon-chain/p2p/service.go:218 +0xe24
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll.func1()
      runtime/service_registry.go:46 +0x42
Previous write at #HEX by go routine: #DIG:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p.(*Service).AddPingMethod()
      beacon-chain/p2p/service.go:357 +0x37
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync.(*Service).Start()
      beacon-chain/sync/service.go:234 +0x67c
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll.func1()
      runtime/service_registry.go:46 +0x42
go routine: #DIG (running) created at:
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll()
      runtime/service_registry.go:46 +0x17e
  github.com/prysmaticlabs/prysm/v5/beacon-chain/node.(*BeaconNode).Start()
      beacon-chain/node/node.go:378 +0x1ed
  main.startNode()
      cmd/beacon-chain/main.go:311 +0xc26
  main.main.func1()
      cmd/beacon-chain/main.go:160 +0x38
  github.com/urfave/cli/v2.(*Command).Run()
      external/com_github_urfave_cli_v2/command.go:274 +0x13f4
  github.com/urfave/cli/v2.(*App).RunContext()
      external/com_github_urfave_cli_v2/app.go:332 +0x1249
  main.main()
      cmd/beacon-chain/main.go:233 +0x58a
go routine: #DIG (finished) created at:
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll()
      runtime/service_registry.go:46 +0x17e
  github.com/prysmaticlabs/prysm/v5/beacon-chain/node.(*BeaconNode).Start()
      beacon-chain/node/node.go:378 +0x1ed
  main.startNode()
      cmd/beacon-chain/main.go:311 +0xc26
  main.main.func1()
      cmd/beacon-chain/main.go:160 +0x38
  github.com/urfave/cli/v2.(*Command).Run()
      external/com_github_urfave_cli_v2/command.go:274 +0x13f4
  github.com/urfave/cli/v2.(*App).RunContext()
      external/com_github_urfave_cli_v2/app.go:332 +0x1249
  main.main()
      cmd/beacon-chain/main.go:233 +0x58a

@qu0b qu0b requested a review from a team as a code owner March 7, 2024 12:05
@qu0b qu0b requested review from nalepae, potuz and terencechain March 7, 2024 12:05
@prestonvanloon prestonvanloon enabled auto-merge March 7, 2024 18:24
@prestonvanloon prestonvanloon added this pull request to the merge queue Mar 7, 2024
Merged via the queue into prysmaticlabs:develop with commit 4608569 Mar 7, 2024
17 checks passed
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.

2 participants