celestiaorg / celestiaorg/celestia-node

testing(core): race in TestListenerWithNonEmptyBlocks

Open
#2,181 0 comments 0 reactions 0 assignees View on GitHub
area:core_and_app kind:testing
Dominant language
Go
Stars
996
Forks
1.1k
Avg merge
1d 6h
Merged PRs (30d)
34

Description

### Flaky data race

https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:25
```
WARNING: DATA RACE
Write at 0x00c002e13090 by goroutine 5167:
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).BeginBlock()
/home/runner/go/pkg/mod/github.com/celestiaorg/cosmos-sdk@v1.8.0-sdk-v0.46.7/baseapp/abci.go:177 +0xa6b
github.com/celestiaorg/celestia-app/app.(*App).BeginBlock()
:1 +0x97
github.com/tendermint/tendermint/abci/client.(*localClient).BeginBlockSync()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/abci/client/local_client.go:306 +0x174
github.com/tendermint/tendermint/proxy.(*appConnConsensus).BeginBlockSync()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/proxy/app_conn.go:84 +0xb7
github.com/tendermint/tendermint/state.execBlockOnProxyApp()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/state/execution.go:377 +0x6fc
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/state/execution.go:210 +0x22d
github.com/tendermint/tendermint/consensus.(*State).finalizeCommit()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:1668 +0x12cc
github.com/tendermint/tendermint/consensus.(*State).tryFinalizeCommit()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:1576 +0x495
github.com/tendermint/tendermint/consensus.(*State).enterCommit.func1()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:1511 +0x13d
runtime.deferreturn()
/opt/hostedtoolcache/go/1.20.3/x64/src/runtime/panic.go:476 +0x32
github.com/tendermint/tendermint/consensus.(*State).addVote()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:2171 +0x2b64
github.com/tendermint/tendermint/consensus.(*State).tryAddVote()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:1963 +0x77
github.com/tendermint/tendermint/consensus.(*State).handleMsg()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:853 +0x65c
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:780 +0x6cb
github.com/tendermint/tendermint/consensus.(*State).OnStart.func1()
/home/runner/go/pkg/mod/github.com/celestiaorg/celestia-core@v1.15.0-tm-v0.34.23/consensus/state.go:379 +0x3b

Previous read at 0x00c002e13090 by goroutine 6261:
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).createQueryContext()
/home/runner/go/pkg/mod/github.com/celestiaorg/cosmos-sdk@v1.8.0-sdk-v0.46.7/baseapp/abci.go:668 +0x519
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func1()
/home/runner/go/pkg/mod/github.com/celestiaorg/cosmos-sdk@v1.8.0-sdk-v0.46.7/baseapp/grpcserver.go:50 +0x1c9
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1()
/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:[25](https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:26) +0x8e
github.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1()
/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/recovery/interceptors.go:33 +0x139
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1()
/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x8e
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1()
/home/runner/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:34 +0x1[26](https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:27)
github.com/cosmos/cosmos-sdk/x/auth/types._Query_Account_Handler()
/home/runner/go/pkg/mod/github.com/celestiaorg/cosmos-sdk@v1.8.0-sdk-v0.46.7/x/auth/types/query.pb.go:1178 +0x1dd
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).RegisterGRPCServer.func2()
/home/runner/go/pkg/mod/github.com/celestiaorg/cosmos-sdk@v1.8.0-sdk-v0.46.7/baseapp/grpcserver.go:82 +0x13b
google.golang.org/grpc.(*Server).processUnaryRPC()
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.53.0/server.go:1[33](https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:34)6 +0x177a
google.golang.org/grpc.(*Server).handleStream()
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.[53](https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:54).0/server.go:1704 +0xff8
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/home/runner/go/pkg/mod/google.golang.org/grpc@v1.53.0/server.go:9[65](https://github.com/celestiaorg/celestia-node/actions/runs/4928790196/jobs/8807592653?pr=2155#step:4:66) +0xec
```

Contributor guide

Open the contributing guide

Research direction

Locate the TestListenerWithNonEmptyBlocks test and reproduce it with Go's race detector. Read the reported BeginBlock and createQueryContext paths to understand the concurrent access, then verify that the test completes without the reported data race.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.