[ 
https://issues.apache.org/jira/browse/THRIFT-2458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13968330#comment-13968330
 ] 

ASF GitHub Bot commented on THRIFT-2458:
----------------------------------------

GitHub user apesternikov opened a pull request:

    https://github.com/apache/thrift/pull/99

    THRIFT-2458 Generated code for oneway function

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apesternikov/thrift go-oneway

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/99.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #99
    
----
commit 5f4833d0dda663e8432c6ed61dae38fa42d52ed9
Author: Aleksey Pesternikov <[email protected]>
Date:   2014-04-14T12:59:39Z

    THRIFT-2458 Generated code for oneway function

----


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

Reply via email to