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
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 @@
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 @@
// 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)
}