erigontech / erigon

Ethereum implementation on the efficiency frontier https://erigon.gitbook.io
GNU Lesser General Public License v3.0
3.14k stars 1.11k forks source link

cl: race in tests #12484

Closed AskAlexSharov closed 5 days ago

AskAlexSharov commented 1 week ago

go test -race ./cl/...

main 9756fc70498120f2e5ffa00a510c301e91a2eaa3

==================
WARNING: DATA RACE
Write at 0x00c000e18000 by goroutine 293:
  runtime.slicecopy()
      /usr/local/go/src/runtime/slice.go:325 +0x0
  github.com/erigontech/erigon/cl/merkle_tree.(*MerkleTree).MarkLeafAsDirty()
      /home/ubuntu/erigon/cl/merkle_tree/merkle_tree.go:70 +0x2bc
  github.com/erigontech/erigon/cl/cltypes/solid.(*byteBasedUint64Slice).Set()
      /home/ubuntu/erigon/cl/cltypes/solid/uint64slice_byte.go:163 +0xa6
  github.com/erigontech/erigon/cl/cltypes/solid.(*uint64ListSSZ).Set()
      /home/ubuntu/erigon/cl/cltypes/solid/uint64_list.go:83 +0x49
  github.com/erigontech/erigon/cl/phase1/core/state/raw.(*BeaconState).SetValidatorBalance()
      /home/ubuntu/erigon/cl/phase1/core/state/raw/setters.go:255 +0x1cf
  github.com/erigontech/erigon/cl/phase1/core/state.(*CachingBeaconState).SetValidatorBalance()
      <autogenerated>:1 +0x5b
  github.com/erigontech/erigon/cl/phase1/core/state.IncreaseBalance()
      /home/ubuntu/erigon/cl/phase1/core/state/mutators.go:26 +0x8c
  github.com/erigontech/erigon/cl/transition/impl/eth2/statechange.processRewardsAndPenaltiesPostAltair.func1()
      /home/ubuntu/erigon/cl/transition/impl/eth2/statechange/process_rewards_and_penalties.go:129 +0x4fa
  github.com/erigontech/erigon/cl/utils/threading.ParallellForLoop.func1()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:70 +0x5e
  github.com/erigontech/erigon/cl/utils/threading.(*WorkerPool).StartWorker()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:37 +0x9e
  github.com/erigontech/erigon/cl/utils/threading.CreateWorkerPool.gowrap1()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:21 +0x33

Previous write at 0x00c000e18000 by goroutine 294:
  runtime.slicecopy()
      /usr/local/go/src/runtime/slice.go:325 +0x0
  github.com/erigontech/erigon/cl/merkle_tree.(*MerkleTree).MarkLeafAsDirty()
      /home/ubuntu/erigon/cl/merkle_tree/merkle_tree.go:70 +0x2bc
  github.com/erigontech/erigon/cl/cltypes/solid.(*byteBasedUint64Slice).Set()
      /home/ubuntu/erigon/cl/cltypes/solid/uint64slice_byte.go:163 +0xa6
  github.com/erigontech/erigon/cl/cltypes/solid.(*uint64ListSSZ).Set()
      /home/ubuntu/erigon/cl/cltypes/solid/uint64_list.go:83 +0x49
  github.com/erigontech/erigon/cl/phase1/core/state/raw.(*BeaconState).SetValidatorBalance()
      /home/ubuntu/erigon/cl/phase1/core/state/raw/setters.go:255 +0x1cf
  github.com/erigontech/erigon/cl/phase1/core/state.(*CachingBeaconState).SetValidatorBalance()
      <autogenerated>:1 +0x5b
  github.com/erigontech/erigon/cl/phase1/core/state.DecreaseBalance()
      /home/ubuntu/erigon/cl/phase1/core/state/mutators.go:38 +0x9a
  github.com/erigontech/erigon/cl/transition/impl/eth2/statechange.processRewardsAndPenaltiesPostAltair.func1()
      /home/ubuntu/erigon/cl/transition/impl/eth2/statechange/process_rewards_and_penalties.go:132 +0x544
  github.com/erigontech/erigon/cl/utils/threading.ParallellForLoop.func1()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:70 +0x5e
  github.com/erigontech/erigon/cl/utils/threading.(*WorkerPool).StartWorker()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:37 +0x9e
  github.com/erigontech/erigon/cl/utils/threading.CreateWorkerPool.gowrap1()
      /home/ubuntu/erigon/cl/utils/threading/worker_pool.go:21 +0x33

==================
--- FAIL: TestBlockProcessing (0.58s)
==================
WARNING: DATA RACE
Write at 0x00c0033ce060 by goroutine 28:
  github.com/erigontech/erigon/cl/sentinel.(*GossipSubscription).Close.func1()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:605 +0x27d
  sync.(*Once).doSlow()
      /usr/local/go/src/sync/once.go:74 +0xf0
  sync.(*Once).Do()
      /usr/local/go/src/sync/once.go:65 +0x44
  github.com/erigontech/erigon/cl/sentinel.(*GossipSubscription).Close()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:589 +0xe4
  github.com/erigontech/erigon/cl/sentinel.(*Sentinel).Stop.(*GossipManager).Close.func2()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:492 +0x44
  sync.(*Map).Range()
      /usr/local/go/src/sync/map.go:477 +0x1e5
  github.com/erigontech/erigon/cl/sentinel.(*GossipManager).Close()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:490 +0xcc
  github.com/erigontech/erigon/cl/sentinel.(*Sentinel).Stop()
      /home/ubuntu/erigon/cl/sentinel/sentinel.go:352 +0x46
  github.com/erigontech/erigon/cl/sentinel.TestSentinelGossipOnHardFork.deferwrap2()
      /home/ubuntu/erigon/cl/sentinel/sentinel_gossip_test.go:82 +0x33
  runtime.deferreturn()
      /usr/local/go/src/runtime/panic.go:602 +0x5d
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44

Previous read at 0x00c0033ce060 by goroutine 1292:
  github.com/erigontech/erigon/cl/sentinel.(*GossipManager).Start.func1.2()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:516 +0x7a
  sync.(*Map).Range()
      /usr/local/go/src/sync/map.go:477 +0x1e5
  github.com/erigontech/erigon/cl/sentinel.(*GossipManager).Start.func1()
      /home/ubuntu/erigon/cl/sentinel/gossip.go:514 +0x20f
==================
--- FAIL: TestSentinelGossipOnHardFork (11.05s)
==================
WARNING: DATA RACE
Write at 0x000003a6f8d0 by goroutine 8519:
  github.com/erigontech/erigon/cl/phase1/network/services.(*blsToExecutionChangeTestSuite).SetupTest()
      /home/ubuntu/erigon/cl/phase1/network/services/bls_to_execution_change_service_test.go:61 +0x851
  github.com/erigontech/erigon/cl/phase1/network/services.(*blsToExecutionChangeTestSuite).TestProcessMessage()
      /home/ubuntu/erigon/cl/phase1/network/services/bls_to_execution_change_service_test.go:216 +0xc11
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:770 +0x42
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:380 +0xb5
  github.com/stretchr/testify/suite.Run.func1()
      /home/ubuntu/go/pkg/mod/github.com/stretchr/testify@v1.9.0/suite/suite.go:202 +0x6f1
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1742 +0x44

Previous read at 0x000003a6f8d0 by goroutine 8521:
  github.com/erigontech/erigon/cl/phase1/network/services.(*BatchSignatureVerifier).start()
      /home/ubuntu/erigon/cl/phase1/network/services/batch_signature_verification.go:80 +0x50
  github.com/erigontech/erigon/cl/phase1/network/services.(*BatchSignatureVerifier).Start.gowrap1()
      /home/ubuntu/erigon/cl/phase1/network/services/batch_signature_verification.go:72 +0x44
==================
WARNING: DATA RACE
Write at 0x00c0006dfa70 by goroutine 1240:
  github.com/erigontech/erigon/cl/beacon/handler.(*ApiHandler).getDutiesProposer.func1()
      /home/ubuntu/erigon/cl/beacon/handler/duties_proposer.go:132 +0x450
  github.com/erigontech/erigon/cl/beacon/handler.(*ApiHandler).getDutiesProposer.gowrap2()
      /home/ubuntu/erigon/cl/beacon/handler/duties_proposer.go:141 +0xd9

Previous write at 0x00c0006dfa70 by goroutine 1227:
  github.com/erigontech/erigon/cl/beacon/handler.(*ApiHandler).getDutiesProposer.func1()
      /home/ubuntu/erigon/cl/beacon/handler/duties_proposer.go:132 +0x450
  github.com/erigontech/erigon/cl/beacon/handler.(*ApiHandler).getDutiesProposer.gowrap2()
      /home/ubuntu/erigon/cl/beacon/handler/duties_proposer.go:141 +0xd9
Giulio2002 commented 5 days ago

So these are actually not problematic. i fixed the only one problematic bls_execution the reason is that these races all race to set a value to 0, which whatever I guess :|