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 c03e2aa THRIFT-4984: Ignore EOF error in TSimpleServer ReadFrame call
c03e2aa is described below
commit c03e2aa196615bc3149d1829b8b8ed01e58c7aa1
Author: Yuxuan 'fishy' Wang <[email protected]>
AuthorDate: Wed Oct 23 13:43:09 2019 -0700
THRIFT-4984: Ignore EOF error in TSimpleServer ReadFrame call
EOF isn't an error that should be bubbled up to the
caller and we are already ignoring other EOF errors in
TSimpleServer.processRequest [0].
Client: go
This closes #1904.
[0]:
https://github.com/apache/thrift/blob/cecee50308fc7e6f77f55b3fd906c1c6c471fa2f/lib/go/thrift/simple_server.go#L265-L266
---
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 f8efbed..c1ab957 100644
--- a/lib/go/thrift/simple_server.go
+++ b/lib/go/thrift/simple_server.go
@@ -20,6 +20,7 @@
package thrift
import (
+ "io"
"log"
"runtime/debug"
"sync"
@@ -231,7 +232,7 @@ func (p *TSimpleServer) processRequests(client TTransport)
error {
defer func() {
if e := recover(); e != nil {
- log.Printf("panic in processor: %s: %s", e,
debug.Stack())
+ log.Printf("panic in processor: %v: %s", e,
debug.Stack())
}
}()
@@ -255,9 +256,12 @@ func (p *TSimpleServer) processRequests(client TTransport)
error {
// won't break when it's called again later when we
// actually start to read the message.
if err := headerProtocol.ReadFrame(); err != nil {
+ if err == io.EOF {
+ return nil
+ }
return err
}
- ctx = AddReadTHeaderToContext(defaultCtx,
headerProtocol.GetReadHeaders())
+ ctx = AddReadTHeaderToContext(ctx,
headerProtocol.GetReadHeaders())
ctx = SetWriteHeaderList(ctx, p.forwardHeaders)
}