celestiaorg / celestia-node

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

[Bug][Unit][CI]: CoreListener test is failing with race flag #579

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 Corelistener test
  2. Push a PR

Expected result

Test passes

Actual result

Test fails with context deadline error

Relevant log output

=== RUN   TestCoreListener
    core_listener_test.go:42: 
            Error Trace:    core_listener_test.go:42
            Error:          Received unexpected error:
                            context deadline exceeded
            Test:           TestCoreListener
--- FAIL: TestCoreListener (15.02s)

Notes

More info: https://github.com/celestiaorg/celestia-node/runs/5767716987?check_suite_focus=true

Ref: #491 #578

tzdybal commented 2 years ago

On my local machine, go test -race ./... sometimes results something like this:

==================
WARNING: DATA RACE
Write at 0x0000025b6fd8 by goroutine 31:
  github.com/tendermint/tendermint/rpc/core.SetEnvironment()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/rpc/core/env.go:44 +0xa56
  github.com/tendermint/tendermint/node.(*Node).ConfigureRPC()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/node/node.go:1026 +0x289
  github.com/tendermint/tendermint/node.(*Node).startRPC()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/node/node.go:1057 +0x4a
  github.com/tendermint/tendermint/node.(*Node).OnStart()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/node/node.go:910 +0x3c8
  github.com/tendermint/tendermint/libs/service.(*BaseService).Start()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/service/service.go:140 +0x43a
  github.com/tendermint/tendermint/rpc/test.StartTendermint()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/rpc/test/helpers.go:125 +0x114
  github.com/celestiaorg/celestia-node/core.StartTestNode()
      /home/tomek/devel/celestia/celestia-node/core/testing.go:17 +0x6a
  github.com/celestiaorg/celestia-node/core.StartTestKVApp()
      /home/tomek/devel/celestia/celestia-node/core/testing.go:27 +0x5b
  github.com/celestiaorg/celestia-node/core.StartTestClient()
      /home/tomek/devel/celestia/celestia-node/core/testing.go:41 +0x36
  github.com/celestiaorg/celestia-node/service/header.createCoreFetcher()
      /home/tomek/devel/celestia/celestia-node/service/header/core_exchange_test.go:37 +0x132
  github.com/celestiaorg/celestia-node/service/header.TestCoreListener()
      /home/tomek/devel/celestia/celestia-node/service/header/core_listener_test.go:32 +0x125
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:1439 +0x213
  testing.(*T).Run.func1()
      /usr/lib/go/src/testing/testing.go:1486 +0x47

Previous read at 0x0000025b6fd8 by goroutine 84:
  ??()
      -:0 +0xffffffffffffffff
  encoding/json.(*encodeState).reflectValue()
      /usr/lib/go/src/encoding/json/encode.go:360 +0x88
  encoding/json.(*encodeState).marshal()
      /usr/lib/go/src/encoding/json/encode.go:332 +0x20b
  encoding/json.Marshal()
      /usr/lib/go/src/encoding/json/encode.go:161 +0x51
  github.com/tendermint/tendermint/libs/json.encodeStdlib()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:243 +0x44
  github.com/tendermint/tendermint/libs/json.encodeReflectStruct()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:201 +0x2ac
  github.com/tendermint/tendermint/libs/json.encodeReflect()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:102 +0xc2e
  github.com/tendermint/tendermint/libs/json.encodeReflectStruct()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:207 +0x316
  github.com/tendermint/tendermint/libs/json.encodeReflect()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:102 +0xc2e
  github.com/tendermint/tendermint/libs/json.encodeReflectStruct()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:207 +0x316
  github.com/tendermint/tendermint/libs/json.encodeReflect()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:102 +0xc2e
  github.com/tendermint/tendermint/libs/json.encodeReflectInterface()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:234 +0x39d
  github.com/tendermint/tendermint/libs/json.encodeReflect()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:93 +0xae7
  github.com/tendermint/tendermint/libs/json.encodeReflectStruct()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:207 +0x316
  github.com/tendermint/tendermint/libs/json.encodeReflect()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:102 +0xc2e
  github.com/tendermint/tendermint/libs/json.encode()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:60 +0x20b
  github.com/tendermint/tendermint/libs/json.Marshal()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/libs/json/encoder.go:24 +0x55
  github.com/tendermint/tendermint/rpc/jsonrpc/types.NewRPCSuccessResponse()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/rpc/jsonrpc/types/types.go:192 +0x92
  github.com/tendermint/tendermint/rpc/core.Subscribe.func1()
      /home/tomek/devel/go/pkg/mod/github.com/celestiaorg/celestia-core@v0.34.15-celestia/rpc/core/events.go:53 +0x2b1

Goroutine 31 (running) created at:
  testing.(*T).Run()
      /usr/lib/go/src/testing/testing.go:1486 +0x724
  testing.runTests.func1()
      /usr/lib/go/src/testing/testing.go:1839 +0x99
  testing.tRunner()
      /usr/lib/go/src/testing/testing.go:1439 +0x213
  testing.runTests()
      /usr/lib/go/src/testing/testing.go:1837 +0x7e4
  testing.(*M).Run()
      /usr/lib/go/src/testing/testing.go:1719 +0xa71
  main.main()
      _testmain.go:79 +0x2e4
==================
Wondertan commented 2 years ago

@tzdybal, same for me. This should be fix automatically, once we update to newer Tendermint version