cosmos / iavl

Merkleized IAVL+ Tree implementation in Go
Apache License 2.0
409 stars 256 forks source link

Why got error: orphan expires before it comes alive. 41 > 40. #873

Open 0xEclair opened 5 months ago

0xEclair commented 5 months ago

I'm using cosmos-sdk v0.46.13 to build blockchain. Correspond iavl version is v0.19.6.

When commit large kv pairs in module in cosmos-sdk, got this error.

I want to figure out why this happened and how solve the problem.

tac0turtle commented 5 months ago

what is the error you got?

0xEclair commented 5 months ago

Full error message is: CONSENSUS FAILURE!!! orphan expires before it comes alive. 41 > 40.

This's stack.

goroutine 332 [running]:
runtime/debug.Stack()
    /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine.func2()
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:732 +0x46
panic({0x2644780?, 0xc0464cdcc0?})
    /usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/cosmos/cosmos-sdk/store/iavl.(*Store).Commit(0xc000c54820)
    /root/go/pkg/mod/github.com/evmos/cosmos-sdk@v0.46.13-ledger.3/store/iavl/store.go:134 +0xdf
github.com/cosmos/cosmos-sdk/store/rootmulti.commitStores(0x2a, 0xc000a77b90, 0x29f4a80?)
    /root/go/pkg/mod/github.com/evmos/cosmos-sdk@v0.46.13-ledger.3/store/rootmulti/store.go:1071 +0x158
github.com/cosmos/cosmos-sdk/store/rootmulti.(*Store).Commit(0xc000a914a0)
    /root/go/pkg/mod/github.com/evmos/cosmos-sdk@v0.46.13-ledger.3/store/rootmulti/store.go:428 +0x85
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Commit(0xc000cf2e00)
    /root/go/pkg/mod/github.com/evmos/cosmos-sdk@v0.46.13-ledger.3/baseapp/abci.go:313 +0x14d
github.com/tendermint/tendermint/abci/client.(*localClient).CommitSync(0xc0009809c0)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/abci/client/local_client.go:264 +0xab
github.com/tendermint/tendermint/proxy.(*appConnConsensus).CommitSync(0x258e700?)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/proxy/app_conn.go:93 +0x1b
github.com/tendermint/tendermint/state.(*BlockExecutor).Commit(_, {{{0xb, 0x0}, {0xc050db3720, 0x7}}, {0xc050db3730, 0xe}, 0x1, 0x2a, {{0xd29a1a3fc0, ...}, ...}, ...}, ...)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/state/execution.go:228 +0x252
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock(_, {{{0xb, 0x0}, {0xc050db3720, 0x7}}, {0xc050db3730, 0xe}, 0x1, 0x2a, {{0xd29a1a3fc0, ...}, ...}, ...}, ...)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/state/execution.go:180 +0x6ce
github.com/tendermint/tendermint/consensus.(*State).finalizeCommit(0xc050f40e00, 0x2a)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:1661 +0xadd
github.com/tendermint/tendermint/consensus.(*State).tryFinalizeCommit(0xc050f40e00, 0x2a)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:1570 +0x2f6
github.com/tendermint/tendermint/consensus.(*State).enterCommit.func1()
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:1505 +0x9c
github.com/tendermint/tendermint/consensus.(*State).enterCommit(0xc050f40e00, 0x2a, 0x0)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:1543 +0xc5b
github.com/tendermint/tendermint/consensus.(*State).addVote(0xc050f40e00, 0xc9251683c0, {0x0, 0x0})
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:2164 +0x17a5
github.com/tendermint/tendermint/consensus.(*State).tryAddVote(0xc050f40e00, 0xc9251683c0, {0x0?, 0x4dd210?})
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:1962 +0x26
github.com/tendermint/tendermint/consensus.(*State).handleMsg(0xc050f40e00, {{0x39a03e0, 0xc107936360}, {0x0, 0x0}})
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:861 +0x3ce
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine(0xc050f40e00, 0x0)
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:788 +0x4bc
created by github.com/tendermint/tendermint/consensus.(*State).OnStart in goroutine 1
    /root/go/pkg/mod/github.com/cometbft/cometbft@v0.34.29/consensus/state.go:379 +0x10c
0xEclair commented 5 months ago

Are there side effects if i remove this check?