You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dc...@apache.org on 2019/11/08 09:02:17 UTC

[thrift] branch master updated: THRIFT-4984: Handle wrapped io.EOF errors

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

dcelasun 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 963812a  THRIFT-4984: Handle wrapped io.EOF errors
963812a is described below

commit 963812ae62579f6040b805218d9e798e1e66b324
Author: Yuxuan 'fishy' Wang <yu...@reddit.com>
AuthorDate: Fri Nov 8 01:02:00 2019 -0800

    THRIFT-4984: Handle wrapped io.EOF errors
    
    TCompactProtocol (which is used by THeaderTransport to read headers)
    could wrap the underlying error with TProtocolException, which breaks
    err == io.EOF test in some cases.
    
    Client: go
    
    This closes #1922.
---
 lib/go/thrift/simple_server.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/go/thrift/simple_server.go b/lib/go/thrift/simple_server.go
index aa5a6a6..756d4cf 100644
--- a/lib/go/thrift/simple_server.go
+++ b/lib/go/thrift/simple_server.go
@@ -221,7 +221,9 @@ func treatEOFErrorsAsNil(err error) error {
 	if err == nil {
 		return nil
 	}
-	if err == io.EOF {
+	// err could be io.EOF wrapped with TProtocolException,
+	// so that err == io.EOF doesn't necessarily work in some cases.
+	if err.Error() == io.EOF.Error() {
 		return nil
 	}
 	if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE {