Skip to content

Commit

Permalink
[FAB-5052] [FAB-5051] Fine tune log messages
Browse files Browse the repository at this point in the history
FAB-5052:
In gossip when a peer obtains an AliveMessage from a peer it hasn't
received its certificate yet - it complains in the log in WARNING that
it has received a message from some peer it can't verify its identity.

This is actually a common scenario where a peer is restarted and its
in-meory certificate store is now empty, but the other peers contact
the peer and send it alive messages which he can't verify until it syncs
its certificates with them.

This startles users and I think we should reduce the logging severity
from WARN to DEBUG.

FAB-5051:
When a peer is in a partition or is dead for a long enough time,
gossip prints:
        Haven't heard from", <gibberish>, "for" <elapsed time>

The problem is that the id is a string of a hash and its
printed in gibberish.
It's not something humans can read,
and we need to cast the string back to []byte so it would be human readable.

Change-Id: I94bcad11623e53b5275ef8cecbdd3f9563fa1e77
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Jun 30, 2017
1 parent b93fb81 commit 2993534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions gossip/discovery/discovery_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (d *gossipDiscoveryImpl) handleMsgFromComm(m *proto.SignedGossipMessage) {
return
}
if !d.crypt.ValidateAliveMsg(dm) {
d.logger.Warningf("Alive message isn't authentic, someone spoofed %s's identity", dm.GetAliveMsg().Membership)
d.logger.Debugf("Alive message isn't authentic, someone spoofed %s's identity", dm.GetAliveMsg().Membership)
continue
}

Expand Down Expand Up @@ -488,7 +488,7 @@ func (d *gossipDiscoveryImpl) handleAliveMessage(m *proto.SignedGossipMessage) {
defer d.logger.Debug("Exiting")

if !d.crypt.ValidateAliveMsg(m) {
d.logger.Warningf("Alive message isn't authentic, someone must be spoofing %s's identity", m.GetAliveMsg())
d.logger.Debugf("Alive message isn't authentic, someone must be spoofing %s's identity", m.GetAliveMsg())
return
}

Expand Down Expand Up @@ -719,7 +719,7 @@ func (d *gossipDiscoveryImpl) getDeadMembers() []common.PKIidType {
for id, last := range d.aliveLastTS {
elapsedNonAliveTime := time.Since(last.lastSeen)
if elapsedNonAliveTime.Nanoseconds() > getAliveExpirationTimeout().Nanoseconds() {
d.logger.Warning("Haven't heard from", id, "for", elapsedNonAliveTime)
d.logger.Warning("Haven't heard from", []byte(id), "for", elapsedNonAliveTime)
dead = append(dead, common.PKIidType(id))
}
}
Expand Down
2 changes: 1 addition & 1 deletion gossip/gossip/gossip_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ func (sa *discoverySecurityAdapter) ValidateAliveMsg(m *proto.SignedGossipMessag
}

if identity == nil {
sa.logger.Warning("Don't have certificate for", am)
sa.logger.Debug("Don't have certificate for", am)
return false
}

Expand Down

0 comments on commit 2993534

Please sign in to comment.