Browse Source

p2p: reduce log severity (#5338)

## Description

This PR aims to reduce the amount of `Logger.Error(..)` calls. Many of these calls are benign and do not need any intervention. 

Went from: 
```
node1    | E[2020-09-08|14:32:48.407] Connection failed @ recvRoutine (reading byte) module=p2p peer=af8747a81383f40583ae8790d2cc1f92cc7e4a35@192.167.10.4:26656 conn=MConn{192.167.10.4:26656} err="read tcp 192.167.10.3:48614->192.167.10.4:26656: read: connection reset by peer"
node1    | E[2020-09-08|14:32:48.407] Stopping peer for error                      module=p2p peer="Peer{MConn{192.167.10.4:26656} af8747a813 out}" err="read tcp 192.167.10.3:48614->192.167.10.4:26656: read: connection reset by peer"
node1    | E[2020-09-08|14:32:48.407] Error while stopping peer                    module=p2p peer=af8747a81383f40583ae8790d2cc1f92cc7e4a35@192.167.10.4:26656 err="already stopped"
node1    | E[2020-09-08|14:32:48.408] MConnection flush failed                     module=p2p peer=af8747a81383f40583ae8790d2cc1f92cc7e4a35@192.167.10.4:26656 err="write tcp 192.167.10.3:48614->192.167.10.4:26656: use of closed network connection"
```
To: 
```
node1    | E[2020-09-08|14:42:54.023] Stopping peer for error                      module=p2p peer="Peer{MConn{192.167.10.5:37844} e3d01d1795 in}" err=EOF
```

Closes: #4937
pull/5346/head
Marko 4 years ago
committed by GitHub
parent
commit
098ebaee22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions
  1. +4
    -4
      p2p/conn/connection.go
  2. +1
    -1
      p2p/peer.go

+ 4
- 4
p2p/conn/connection.go View File

@ -323,7 +323,7 @@ func (c *MConnection) flush() {
c.Logger.Debug("Flush", "conn", c)
err := c.bufConnWriter.Flush()
if err != nil {
c.Logger.Error("MConnection flush failed", "err", err)
c.Logger.Debug("MConnection flush failed", "err", err)
}
}
@ -597,7 +597,7 @@ FOR_LOOP:
if err == io.EOF {
c.Logger.Info("Connection is closed @ recvRoutine (likely by the other side)", "conn", c)
} else {
c.Logger.Error("Connection failed @ recvRoutine (reading byte)", "conn", c, "err", err)
c.Logger.Debug("Connection failed @ recvRoutine (reading byte)", "conn", c, "err", err)
}
c.stopForError(err)
}
@ -626,7 +626,7 @@ FOR_LOOP:
channel, ok := c.channelsIdx[byte(pkt.PacketMsg.ChannelID)]
if !ok || channel == nil {
err := fmt.Errorf("unknown channel %X", pkt.PacketMsg.ChannelID)
c.Logger.Error("Connection failed @ recvRoutine", "conn", c, "err", err)
c.Logger.Debug("Connection failed @ recvRoutine", "conn", c, "err", err)
c.stopForError(err)
break FOR_LOOP
}
@ -634,7 +634,7 @@ FOR_LOOP:
msgBytes, err := channel.recvPacketMsg(*pkt.PacketMsg)
if err != nil {
if c.IsRunning() {
c.Logger.Error("Connection failed @ recvRoutine", "conn", c, "err", err)
c.Logger.Debug("Connection failed @ recvRoutine", "conn", c, "err", err)
c.stopForError(err)
}
break FOR_LOOP


+ 1
- 1
p2p/peer.go View File

@ -201,7 +201,7 @@ func (p *peer) OnStop() {
p.metricsTicker.Stop()
p.BaseService.OnStop()
if err := p.mconn.Stop(); err != nil { // stop everything and close the conn
p.Logger.Error("Error while stopping peer", "err", err)
p.Logger.Debug("Error while stopping peer", "err", err)
}
}


Loading…
Cancel
Save