-
Notifications
You must be signed in to change notification settings - Fork 780
Closed
Labels
Milestone
Description
Thanks @p4u for reporting this bug!
Bug Report
Setup
CometBFT version: from v0.38 and up
What happened?
Comet panics with the message "recheck cursor is not nil before resCbFirstTime", which is found in this line:
cometbft/mempool/clist_mempool.go
Line 313 in 1f430f5
| panic("recheck cursor is not nil before resCbFirstTime") |
Briefly, when we are using a local ABCI client and the app's CheckTx method returns a non-nil error, the rechecking process is broken at this line, leaving recheckCursor and recheckEnd in an inconsistent state.
These are the steps to reach the panic line:
- Rechecking is started by
recheckTxs, which:- sets
recheckCursorto the first element of the transaction listtxs - for every element in
txs, it sends a CheckTx request to the app. We are using a local client, so the call toproxyAppConn.CheckTxAsyncis synchronous, meaning that it will theCheckTxmethod on the app and immediately call theglobalCbcallback to process the response. - If the app's
CheckTxreturns an error, the functionrecheckTxsreturns without finishing the rechecking process and leavingrecheckCursorwith a non-nil value.recheckCursoris set to nil again only inresCbRecheck, when it's equal torecheckEnd.
- sets
- A
CheckTxrequest of typeCHECK_TX_TYPE_CHECKis sent to the app for a new tx; a response is handled byglobalCb, which will panic becauserecheckCursoris not nil.
Notes
On previous versions of CometBFT, CheckTxAsync didn't return an error, so this problem didn't exist. And when this new behaviour was introduced, the documentation was not updated.
Reactions are currently unavailable