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]: cecee50308/lib/go/thrift/simple_server.go (L265-L266)
This commit is contained in:
Yuxuan 'fishy' Wang 2019-10-23 13:43:09 -07:00 committed by Duru Can Celasun
parent 6e4c581fdd
commit c03e2aa196

View File

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