Skip to content

Mempool can't filter duplicate tx if mempool cache misses it. #5281

@egonspace

Description

@egonspace

Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source):
latest(2975732)

ABCI app (name for built-in, URL for self-written if it's publicly available):
persistent_kvstore

Environment:
MacOS

What happened:
Duplicate transactions can be stacked in mempool when more transactions than mempool cache size are crowded at once or when mempool cache size is zero.

There is a problem that this can lead to duplicate execution of transactions.

There's another bug, and there's a bigger problem that such duplicate transaction won't be remove and remain in the mempool by following code after being executed:

if e, ok := mem.txsMap.Load(TxKey(tx)); ok {

What you expected to happen:
duplicate tx should be on error

Have you tried the latest version: yes/no
yes

How to reproduce it (as minimally and precisely as possible):

  1. set cache_size to 0
  2. execute tendermint with persistent_kvstore
  3. execute following command twice quickly: curl http://localhost:26657/broadcast_tx_sync?tx=\"apple=100\"

Logs (paste a small part showing an error (< 10 lines) or link a pastebin, gist, etc. containing more of the log file):

Config (you can paste only the changes you've made):

node command runtime flags:

Please provide the output from the http://<ip>:<port>/dump_consensus_state RPC endpoint for consensus bugs

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:mempoolComponent: Mempoolstalefor use by stalebot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions