[ https://issues.apache.org/jira/browse/THRIFT-2458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13968827#comment-13968827 ]
ASF GitHub Bot commented on THRIFT-2458: ---------------------------------------- Github user asfgit closed the pull request at: https://github.com/apache/thrift/pull/99 > Generated golang server code for "oneway" methods 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 > Assignee: Jens Geyer > Priority: Critical > Labels: oneway > Fix For: 0.9.2 > > Attachments: Thrift2458.thrift, > thrift-2458_incorrect_oneway_codegen.patch > > > 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. > {code} > 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 > } > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)