celestiaorg / celestia-node

Celestia Data Availability Nodes
Apache License 2.0
925 stars 921 forks source link

[Bug][Unit][CI]: TestBlockFetcherHeaderValues is failing with race flag #582

Closed Bidon15 closed 2 years ago

Bidon15 commented 2 years ago

Celestia Node version

1f83373aa95745d916a3ce822646e9cd29d49973

OS

Github action CI: Ubuntu

Install tools

No response

Others

No response

Steps to reproduce it

  1. Remove skiptest for TestBlockFetcherHeaderValues test
  2. Push a PR

Expected result

Test passes

Actual result

Test fails due to race detection

Relevant log output

=== RUN   TestBlockFetcherHeaderValues
==================
WARNING: DATA RACE
Write at 0x000001ffc0b0 by goroutine 157:
  github.com/tendermint/tendermint/rpc/core.SetEnvironment()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/core/env.go:44 +0xa76
  github.com/tendermint/tendermint/node.(*Node).ConfigureRPC()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/node/node.go:1026 +0x289
  github.com/tendermint/tendermint/node.(*Node).startRPC()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/node/node.go:1057 +0x4a
  github.com/tendermint/tendermint/node.(*Node).OnStart()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/node/node.go:910 +0x3d2
  github.com/tendermint/tendermint/libs/service.(*BaseService).Start()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/libs/service/service.go:140 +0x43a
  github.com/tendermint/tendermint/rpc/test.StartTendermint()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/test/helpers.go:125 +0x114
  github.com/celestiaorg/celestia-node/core.StartMockNode()
      /home/runner/work/celestia-node/celestia-node/core/testing.go:14 +0x84
  github.com/celestiaorg/celestia-node/core.StartRemoteClient()
      /home/runner/work/celestia-node/celestia-node/core/testing.go:28 +0x4b
  github.com/celestiaorg/celestia-node/core.TestBlockFetcherHeaderValues()
      /home/runner/work/celestia-node/celestia-node/core/fetcher_test.go:48 +0x44
  testing.tRunner()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1259 +0x22f
  testing.(*T).Run·dwrap·21()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1306 +0x47

Previous read at 0x000001ffc0b0 by goroutine 158:
  github.com/tendermint/tendermint/rpc/core.Subscribe.func1()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/core/events.go:74 +0xba4

Goroutine 157 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1306 +0x726
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1598 +0x99
  testing.tRunner()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1259 +0x22f
  testing.runTests()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1596 +0x7ca
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.17.7/x64/src/testing/testing.go:1504 +0x9d1
  main.main()
      _testmain.go:53 +0x22b

Goroutine 158 (finished) created at:
  github.com/tendermint/tendermint/rpc/core.Subscribe()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/core/events.go:47 +0x88b
  runtime.call32()
      /opt/hostedtoolcache/go/1.17.7/x64/src/runtime/asm_amd64.s:626 +0x48
  reflect.Value.Call()
      /opt/hostedtoolcache/go/1.17.7/x64/src/reflect/value.go:339 +0xd7
  github.com/tendermint/tendermint/rpc/jsonrpc/server.(*wsConnection).readRoutine()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/jsonrpc/server/ws_handler.go:381 +0xf56
  github.com/tendermint/tendermint/rpc/jsonrpc/server.(*wsConnection).OnStart·dwrap·1()
      /home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.14-celestia.0.20220228062426-721562a3544d/rpc/jsonrpc/server/ws_handler.go:226 +0x39
==================
    testing.go:1152: race detected during execution of test
--- FAIL: TestBlockFetcherHeaderValues (0.08s)

Notes

More information here: https://github.com/celestiaorg/celestia-node/runs/5769509385?check_suite_focus=true

Bidon15 commented 2 years ago

Ref: #579