From 56b3689059bf282a56ac1a20d6cdfd96c3b4edbf Mon Sep 17 00:00:00 2001 From: David Enyeart Date: Sun, 30 May 2021 15:26:25 -0400 Subject: [PATCH] [FAB-18479] Log error if orderer can't forward SubmitRequest to Raft leader If order cannot forward client transaction SubmitRequest to Raft leader, it only logged it in a debug message. And since the error does not get returned to the client either, it is difficult to identify and troubleshoot. This commit changes the message to an error in the orderer log. Signed-off-by: David Enyeart (cherry picked from commit e8e39e6dfcceb14a4998d6ea64542d9d8a7b825b) --- orderer/common/cluster/comm.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/orderer/common/cluster/comm.go b/orderer/common/cluster/comm.go index 8320aa07660..0f903c3a0ee 100644 --- a/orderer/common/cluster/comm.go +++ b/orderer/common/cluster/comm.go @@ -521,6 +521,7 @@ func (stream *Stream) sendOrDrop(request *orderer.StepRequest, allowDrop bool) e case <-stream.abortChan: return errors.Errorf("stream %d aborted", stream.ID) case stream.sendBuff <- request: + // Note - async send, errors are not returned back return nil case <-stream.commShutdown: return nil @@ -528,19 +529,18 @@ func (stream *Stream) sendOrDrop(request *orderer.StepRequest, allowDrop bool) e } // sendMessage sends the request down the stream +// Note - any errors are swallowed and not returned back - TODO Is this intentional? Shouldn't SubmitRequest errors get returned to client? func (stream *Stream) sendMessage(request *orderer.StepRequest) { start := time.Now() var err error defer func() { - if !stream.Logger.IsEnabledFor(zap.DebugLevel) { - return - } - var result string + message := fmt.Sprintf("Send of %s to %s(%s) took %v", + requestAsString(request), stream.NodeName, stream.Endpoint, time.Since(start)) if err != nil { - result = fmt.Sprintf("but failed due to %s", err.Error()) + stream.Logger.Errorf("%s but failed due to %s", message, err.Error()) + } else { + stream.Logger.Debug(message) } - stream.Logger.Debugf("Send of %s to %s(%s) took %v %s", requestAsString(request), - stream.NodeName, stream.Endpoint, time.Since(start), result) }() f := func() (*orderer.StepResponse, error) {