From 6a07d08f4972c91b8c4d43bb6256db415a02f604 Mon Sep 17 00:00:00 2001 From: Tess Rinearson Date: Thu, 3 Dec 2020 23:12:08 +0100 Subject: [PATCH] reactors: omit incoming message bytes from reactor logs (#5743) After a reactor has failed to parse an incoming message, it shouldn't output the "bad" data into the logs, as that data is unfiltered and could have anything in it. (We also don't think this information is helpful to have in the logs anyways.) --- blockchain/v0/reactor.go | 2 +- blockchain/v2/reactor.go | 1 - consensus/reactor.go | 2 +- mempool/reactor.go | 2 +- p2p/pex/pex_reactor.go | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index 574ef3f29..bd396f9bf 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -176,7 +176,7 @@ func (bcR *BlockchainReactor) respondToPeer(msg *bcBlockRequestMessage, func (bcR *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { msg, err := decodeMsg(msgBytes) if err != nil { - bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) + bcR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err) bcR.Switch.StopPeerForError(src, err) return } diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 8f7143083..3505ac448 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -97,7 +97,6 @@ func (r *Reactor) demux() { func (r *Reactor) Stop() { r.logger.Info("reactor stopping") - r.ticker.Stop() r.scheduler.stop() r.processor.stop() diff --git a/consensus/reactor.go b/consensus/reactor.go index 0337c9ff6..11ff5bbe2 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -218,7 +218,7 @@ func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) msg, err := decodeMsg(msgBytes) if err != nil { - conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) + conR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err) conR.Switch.StopPeerForError(src, err) return } diff --git a/mempool/reactor.go b/mempool/reactor.go index 8acb02878..dfa2cbbe9 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -162,7 +162,7 @@ func (memR *Reactor) RemovePeer(peer p2p.Peer, reason interface{}) { func (memR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { msg, err := memR.decodeMsg(msgBytes) if err != nil { - memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) + memR.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err) memR.Switch.StopPeerForError(src, err) return } diff --git a/p2p/pex/pex_reactor.go b/p2p/pex/pex_reactor.go index 140c13f38..bc8cf99b7 100644 --- a/p2p/pex/pex_reactor.go +++ b/p2p/pex/pex_reactor.go @@ -227,7 +227,7 @@ func (r *PEXReactor) logErrAddrBook(err error) { func (r *PEXReactor) Receive(chID byte, src Peer, msgBytes []byte) { msg, err := decodeMsg(msgBytes) if err != nil { - r.Logger.Error("Error decoding message", "src", src, "chId", chID, "msg", msg, "err", err, "bytes", msgBytes) + r.Logger.Error("Error decoding message", "src", src, "chId", chID, "err", err) r.Switch.StopPeerForError(src, err) return }