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 receive block #13700

Merged
merged 4 commits into from
Mar 7, 2024
Merged

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 minor race condition

WARNING: DATA RACE
Write at #HEX by go routine: #DIG:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).ReceiveBlock.func2()
      beacon-chain/blockchain/receive_block.go:105 +0x164
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x97
Previous write at #HEX by go routine: #DIG:
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).ReceiveBlock.func1()
      beacon-chain/blockchain/receive_block.go:97 +0x12a
  golang.org/x/sync/errgroup.(*Group).Go.func1()
      external/org_golang_x_sync/errgroup/errgroup.go:75 +0x97
go routine: #DIG (running) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x124
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).ReceiveBlock()
      beacon-chain/blockchain/receive_block.go:104 +0xdc8
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.blockchainService.ReceiveBlock-fm()
      <autogenerated>:1 +0xcc
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).processBlock()
      beacon-chain/sync/initial-sync/round_robin.go:273 +0x622
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).processFetchedDataRegSync()
      beacon-chain/sync/initial-sync/round_robin.go:181 +0xb50
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).syncToNonFinalizedEpoch()
      beacon-chain/sync/initial-sync/round_robin.go:133 +0x57e
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).roundRobinSync()
      beacon-chain/sync/initial-sync/round_robin.go:61 +0x3f1
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).Start()
      beacon-chain/sync/initial-sync/service.go:166 +0x11e9
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll.func1()
      runtime/service_registry.go:46 +0x42
go routine: #DIG (finished) created at:
  golang.org/x/sync/errgroup.(*Group).Go()
      external/org_golang_x_sync/errgroup/errgroup.go:72 +0x124
  github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).ReceiveBlock()
      beacon-chain/blockchain/receive_block.go:96 +0xb4a
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.blockchainService.ReceiveBlock-fm()
      <autogenerated>:1 +0xcc
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).processBlock()
      beacon-chain/sync/initial-sync/round_robin.go:273 +0x622
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).processFetchedDataRegSync()
      beacon-chain/sync/initial-sync/round_robin.go:181 +0xb50
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).syncToNonFinalizedEpoch()
      beacon-chain/sync/initial-sync/round_robin.go:133 +0x57e
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).roundRobinSync()
      beacon-chain/sync/initial-sync/round_robin.go:61 +0x3f1
  github.com/prysmaticlabs/prysm/v5/beacon-chain/sync/initial-sync.(*Service).Start()
      beacon-chain/sync/initial-sync/service.go:166 +0x11e9
  github.com/prysmaticlabs/prysm/v5/runtime.(*ServiceRegistry).StartAll.func1()
      runtime/service_registry.go:46 +0x42

prestonvanloon and others added 4 commits February 21, 2024 16:48
* avoid part path collisions with mem addr entropy

* Regression test

---------

Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
(cherry picked from commit 4c66e4d)
@qu0b qu0b requested a review from a team as a code owner March 7, 2024 11:48
Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Catch !

@nisdas nisdas enabled auto-merge March 7, 2024 11:56
@nisdas nisdas added this pull request to the merge queue Mar 7, 2024
Merged via the queue into prysmaticlabs:develop with commit 2442280 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.

5 participants