Brian Jiang created THRIFT-2458:
-----------------------------------
Summary: Generated golang server codes for "oneway" interface is
incorrect
Key: THRIFT-2458
URL: https://issues.apache.org/jira/browse/THRIFT-2458
Project: Thrift
Issue Type: Bug
Components: Go - Compiler
Affects Versions: 0.9.1
Reporter: Brian Jiang
Priority: Critical
oneway interface call is only a notification. server shall not send any
response. But currently the golang server codes generated by complier will send
a response. That will make the subsequent RPC call failed due to this
unexpected result in the receiving networking stream. (The client is not
expecting a reply for oneway call)
Here is an example of generated codes for a oneway call (oneway void hi()), it
shall not write a result back.
func (p *testProcessorHi) Process(seqId int32, iprot, oprot thrift.TProtocol)
(success bool, err thrift.TException) {
args := NewHiArgs()
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR,
err.Error())
oprot.WriteMessageBegin("hi", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return
}
iprot.ReadMessageEnd()
result := NewHiResult()
if err = p.handler.Hi(); err != nil {
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR,
"Internal error processing hi: "+err.Error())
oprot.WriteMessageBegin("hi", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return
}
if err2 := oprot.WriteMessageBegin("hi", thrift.REPLY, seqId); err2 !=
nil {
err = err2
}
if err2 := result.Write(oprot); err == nil && err2 != nil {
err = err2
}
if err2 := oprot.WriteMessageEnd(); err == nil && err2 != nil {
err = err2
}
if err2 := oprot.Flush(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
--
This message was sent by Atlassian JIRA
(v6.2#6252)