Skip to content

Commit

Permalink
THRIFT-5509: Suppress noisy log from go's TSimpleServer
Browse files Browse the repository at this point in the history
Client: go

This is a follow up of 6f33b04. 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.
  • Loading branch information
fishy committed Feb 9, 2022
1 parent f18a8f3 commit 3031394
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/go/thrift/simple_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3031394

Please sign in to comment.