erigontech / erigon

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

Race condition on p2p discovery #11158

Closed mh0lt closed 3 months ago

mh0lt commented 3 months ago
==================
WARNING: DATA RACE
Write at 0x00c00012f4f8 by goroutine 1137126:
  github.com/ledgerwatch/erigon/p2p/discover.(*Table).loop.func2()
      github.com/ledgerwatch/erigon/p2p/discover/table.go:301 +0x48

Previous read at 0x00c00012f4f8 by goroutine 5793:
  github.com/ledgerwatch/erigon/p2p/discover.(*Table).loop()
      github.com/ledgerwatch/erigon/p2p/discover/table.go:299 +0xb56
  github.com/ledgerwatch/erigon/p2p/discover.ListenV4.gowrap1()
      github.com/ledgerwatch/erigon/p2p/discover/v4_udp.go:190 +0x33

Goroutine 1137126 (running) created at:
  time.goFunc()
      time/sleep.go:177 +0x44

Goroutine 5793 (running) created at:
  github.com/ledgerwatch/erigon/p2p/discover.ListenV4()
      github.com/ledgerwatch/erigon/p2p/discover/v4_udp.go:190 +0x9cc
  github.com/ledgerwatch/erigon/p2p.(*Server).setupDiscovery()
      github.com/ledgerwatch/erigon/p2p/server.go:656 +0xb46
  github.com/ledgerwatch/erigon/p2p.(*Server).Start()
      github.com/ledgerwatch/erigon/p2p/server.go:531 +0x9d5
  github.com/ledgerwatch/erigon/p2p/sentry.(*GrpcServer).startP2PServer()
      github.com/ledgerwatch/erigon/p2p/sentry/sentry_grpc_server.go:1039 +0x4be
  github.com/ledgerwatch/erigon/p2p/sentry.(*GrpcServer).SetStatus()
      github.com/ledgerwatch/erigon/p2p/sentry/sentry_grpc_server.go:1061 +0x835
  github.com/ledgerwatch/erigon-lib/direct.(*SentryClientDirect).SetStatus()
      github.com/ledgerwatch/erigon-lib/direct/sentry_client.go:231 +0x62
  github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client.SentryReconnectAndPumpStreamLoop[go.shape.*uint8]()
      github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client/sentry_multi_client.go:179 +0x5f9
  github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client.(*MultiClient).RecvUploadMessageLoop()
      github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client/sentry_multi_client.go:95 +0x31e
  github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client.(*MultiClient).StartStreamLoops.gowrap2()
      github.com/ledgerwatch/erigon/p2p/sentry/sentry_multi_client/sentry_multi_client.go:76 +0x6e
==================
AskAlexSharov commented 3 months ago

@mh0lt fixed by https://github.com/ledgerwatch/erigon/pull/11159