You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by yu...@apache.org on 2022/02/09 00:40:22 UTC

[thrift] branch master updated: THRIFT-5509: Suppress noisy log from go's TSimpleServer

This is an automated email from the ASF dual-hosted git repository.

yuxuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new acd19a8  THRIFT-5509: Suppress noisy log from go's TSimpleServer
acd19a8 is described below

commit acd19a8439911f5a3a742bad72ea4d231d1aeec3
Author: Yuxuan 'fishy' Wang <yu...@reddit.com>
AuthorDate: Tue Feb 8 15:07:31 2022 -0800

    THRIFT-5509: Suppress noisy log from go's TSimpleServer
    
    Client: go
    
    This is a follow up of 6f33b0470. After we proactively closed the client
    connection, processor.Process could return NOT_OPEN as a result, and
    those errors being logged will cause the log to be very noisy.
    
    This will also be cherry-picked into 0.16.0 branch.
---
 lib/go/thrift/simple_server.go | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/go/thrift/simple_server.go b/lib/go/thrift/simple_server.go
index 563cbfc..02863ec 100644
--- a/lib/go/thrift/simple_server.go
+++ b/lib/go/thrift/simple_server.go
@@ -238,7 +238,7 @@ func (p *TSimpleServer) Stop() error {
 	return nil
 }
 
-// If err is actually EOF, return nil, otherwise return err as-is.
+// If err is actually EOF or NOT_OPEN, return nil, otherwise return err as-is.
 func treatEOFErrorsAsNil(err error) error {
 	if err == nil {
 		return nil
@@ -247,7 +247,11 @@ func treatEOFErrorsAsNil(err error) error {
 		return nil
 	}
 	var te TTransportException
-	if errors.As(err, &te) && te.TypeId() == END_OF_FILE {
+	// NOT_OPEN returned by processor.Process is usually caused by client
+	// abandoning the connection (e.g. client side time out, or just client
+	// closes connections from the pool because of shutting down).
+	// Those logs will be very noisy, so suppress those logs as well.
+	if errors.As(err, &te) && (te.TypeId() == END_OF_FILE || te.TypeId() == NOT_OPEN) {
 		return nil
 	}
 	return err