Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5260

Fix the thrift compiler generate problematic lua code for the oneway method

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.13.0
    • 0.14.0
    • Lua - Compiler
    • None

    Description

      The oneway method 'testOneway' in file 'test/ThriftTest.thrift', for instance, generated code in file 'test/lua/gen-lua/ThriftTest_ThriftTest.lua' as follows:

      function ThriftTestProcessor:process_testOneway(seqid, iprot, oprot, server_ctx)
      local args = testOneway_args:new{}
      local reply_type = TMessageType.REPLY
      args:read(iprot)
      iprot:readMessageEnd()
      local result = testOneway_result:new{}
      local status, res = pcall(self.handler.testOneway, self.handler, args.secondsToSleep)
      if not status then
      reply_type = TMessageType.EXCEPTION
      result = TApplicationException:new

      {message = res}

      else
      result.success = res
      end
      oprot:writeMessageBegin('testOneway', reply_type, seqid)
      result:write(oprot)
      oprot:writeMessageEnd()
      oprot.trans:flush()
      end

      The 'testOneway_result' is undefined and I think it is wrong to write the 'result' to the 'oprot' since it is nil, but at the same time it is necessary for every process functions to return values from each handler's return.

       

      I have created a pull request here: https://github.com/apache/thrift/pull/2212

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            2er0 zero
            2er0 zero
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h

                Issue deployment