From dev-return-58996-archive-asf-public=cust-asf.ponee.io@thrift.apache.org Wed Aug 5 01:40:11 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 8AD1818057A for ; Wed, 5 Aug 2020 03:40:11 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 736421260A1 for ; Wed, 5 Aug 2020 01:40:02 +0000 (UTC) Received: (qmail 53489 invoked by uid 500); 5 Aug 2020 01:40:01 -0000 Mailing-List: contact dev-help@thrift.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@thrift.apache.org Delivered-To: mailing list dev@thrift.apache.org Received: (qmail 53398 invoked by uid 99); 5 Aug 2020 01:40:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Aug 2020 01:40:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A22474358A for ; Wed, 5 Aug 2020 01:40:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 108747803D4 for ; Wed, 5 Aug 2020 01:40:00 +0000 (UTC) Date: Wed, 5 Aug 2020 01:40:00 +0000 (UTC) From: "zero (Jira)" To: dev@thrift.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (THRIFT-5260) Fix the thrift compiler generate problematic lua code for the oneway method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/THRIFT-5260?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] zero updated THRIFT-5260: ------------------------- Description:=20 The oneway method 'testOneway' in file 'test/ThriftTest.thrift', for instan= ce, generated code in file 'test/lua/gen-lua/ThriftTest_ThriftTest.lua' as = follows: function ThriftTestProcessor:process_testOneway(seqid, iprot, oprot, server= _ctx) local args =3D testOneway_args:new{} local reply_type =3D TMessageType.REPLY args:read(iprot) iprot:readMessageEnd() local result =3D testOneway_result:new{} local status, res =3D pcall(self.handler.testOneway, self.handler, args.se= condsToSleep) if not status then reply_type =3D TMessageType.EXCEPTION result =3D TApplicationException:new {message =3D res} else result.success =3D 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 necessar= y for every process functions to return values from each handler. =C2=A0 [I has created a pull request here: https://github.com/apache/thrift/pull/2= 212|https://github.com/apache/thrift/pull/2212] was: The oneway method 'testOneway' in file 'test/ThriftTest.thrift', for instan= ce, generated code in file 'test/lua/gen-lua/ThriftTest_ThriftTest.lua' as = follows: function ThriftTestProcessor:process_testOneway(seqid, iprot, oprot, server= _ctx) local args =3D testOneway_args:new{} local reply_type =3D TMessageType.REPLY args:read(iprot) iprot:readMessageEnd() local result =3D testOneway_result:new{} local status, res =3D pcall(self.handler.testOneway, self.handler, args.se= condsToSleep) if not status then reply_type =3D TMessageType.EXCEPTION result =3D TApplicationException:new {message =3D res} else result.success =3D 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 necessar= y for every process functions to return values from each handler. =C2=A0 [I New a pull request here: https://github.com/apache/thrift/pull/2212|http= s://github.com/apache/thrift/pull/2212] > Fix the thrift compiler generate problematic lua code for the oneway meth= od > -------------------------------------------------------------------------= -- > > Key: THRIFT-5260 > URL: https://issues.apache.org/jira/browse/THRIFT-5260 > Project: Thrift > Issue Type: Bug > Components: Lua - Compiler > Affects Versions: 0.13.0 > Reporter: zero > Priority: Major > > The oneway method 'testOneway' in file 'test/ThriftTest.thrift', for inst= ance, generated code in file 'test/lua/gen-lua/ThriftTest_ThriftTest.lua' a= s follows: > function ThriftTestProcessor:process_testOneway(seqid, iprot, oprot, serv= er_ctx) > local args =3D testOneway_args:new{} > local reply_type =3D TMessageType.REPLY > args:read(iprot) > iprot:readMessageEnd() > local result =3D testOneway_result:new{} > local status, res =3D pcall(self.handler.testOneway, self.handler, args.= secondsToSleep) > if not status then > reply_type =3D TMessageType.EXCEPTION > result =3D TApplicationException:new > {message =3D res} > else > result.success =3D 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 necess= ary for every process functions to return values from each handler. > =C2=A0 > [I has created a pull request here: https://github.com/apache/thrift/pull= /2212|https://github.com/apache/thrift/pull/2212] -- This message was sent by Atlassian Jira (v8.3.4#803005)