8000 fix(mempool): change "mempool is full" log level to debug by yihuang · Pull Request #4123 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(mempool): change "mempool is full" log level to debug #4123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[log]` Change "mempool is full" log to debug level
([\#4123](https://github.com/cometbft/cometbft/pull/4123))
3 changes: 2 additions & 1 deletion mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ func (mem *CListMempool) handleCheckTxResponse(tx types.Tx, sender p2p.ID) func(
// Check again that mempool isn't full, to reduce the chance of exceeding the limits.
if err := mem.isFull(len(tx)); err != nil {
mem.forceRemoveFromCache(tx) // mempool might have space later
mem.logger.Error(err.Error())
// use debug level to avoid spamming logs when traffic is high
mem.logger.Debug(err.Error())
mem.metrics.RejectedTxs.Add(1)
return err
}
Expand Down
16 changes: 10 additions & 6 deletions mempool/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,16 @@ func (memR *Reactor) TryAddTx(tx types.Tx, sender p2p.Peer) (*abcicli.ReqRes, er
}

reqRes, err := memR.mempool.CheckTx(tx, senderID)
switch {
case errors.Is(err, ErrTxInCache):
memR.Logger.Debug("Tx already exists in cache", "tx", log.NewLazySprintf("%X", tx.Hash()), "sender", senderID)
return nil, err
case err != nil:
memR.Logger.Info("Could not check tx", "tx", log.NewLazySprintf("%X", tx.Hash()), "sender", senderID, "err", err)
if err != nil {
switch {
case errors.Is(err, ErrTxInCache):
memR.Logger.Debug("Tx already exists in cache", "tx", log.NewLazySprintf("%X", tx.Hash()), "sender", senderID)
case errors.As(err, &ErrMempoolIsFull{}):
// using debug level to avoid flooding when traffic is high
memR.Logger.Debug(err.Error())
default:
memR.Logger.Info("Could not check tx", "tx", log.NewLazySprintf("%X", tx.Hash()), "sender", senderID, "err", err)
}
return nil, err
}

Expand Down
Loading
0