From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 77C367030C; Fri, 5 Mar 2021 01:04:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 77C367030C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614895459; bh=nIO+F6NLbpDSQkTrEGO44FkM2uX6laZKalSn9+CXk1k=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ze0INFizHrk19zIWYBCLvpOr3TfCVTc8FmldHSmec412aqMyp5IQBT2Wlr3Bih9qv BsIzZmI5vhGXJtRVktgExF+H09GYAUbtztANjHndCOjbx1/EbvB6SOok46sMJiFxjh f8kx/Oo0lou2lLWW/xcHQJg3j9eGkX4lzOIfySbQ= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 7EB6A7030C for ; Fri, 5 Mar 2021 01:04:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7EB6A7030C Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lHw4s-0008VT-Bt; Fri, 05 Mar 2021 01:04:14 +0300 Date: Fri, 5 Mar 2021 01:04:09 +0300 To: Sergey Kaplun Message-ID: <20210304220409.GK9042@tarantool.org> References: <20210216201044.20952-1-skaplun@tarantool.org> <20210226220704.GF9042@tarantool.org> <20210304132832.GE6842@root> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210304132832.GE6842@root> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92A98208ECBDD29F5B42DD879439ED63E04973C1061E33475182A05F538085040A7EF1AC91BD1C3776EC7F489E83B369B1D304893BDA8694F0FC21194D571BAD1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70386A6136E33FD82EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063798FF8892961A0B3C8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC7E36B7026578E6D990438FBACD0F6D89D5634FFF05BCC1A3389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A29E2F051442AF778941B15DA834481F9449624AB7ADAF3735872C767BF85DA29E625A9149C048EE0A3850AC1BE2E7352629B07FD02F83A64AD6D5ED66289B524E70A05D1297E1BB35872C767BF85DA227C277FBC8AE2E8BEBEE3B39F980227375ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC85D9B7C4F32B44FF57285124B2A10EEC6C00306258E7E6ABB4E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2BBE337FB72E923155C0AF1600DCBC20BE687882DF87116BDE92507921C674EFE X-C1DE0DAB: 0D63561A33F958A57F1A6FEFF08531BD46C40E8D1C8777048608E5C7F2B9828FD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3498EF79680EE3725CDE75E0BEA6AE14BFC607E78840988C5FF35FA710BAA4867E2EAE786E048C62771D7E09C32AA3244CA29FA0549592A413536745DA770BD966BBA718C7E6A9E042927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojSsmoOoMLSh3TdMeG21KEFw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638223E7FE4D4A6FAE9532B2B957F14F3B275A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] core: fix cdata decrementing X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, On 04.03.21, Sergey Kaplun wrote: > Hi, Igor! > > Thanks for the review! > > Added your tag: > | Reviewed-by: Igor Munkin > > On 27.02.21, Igor Munkin wrote: > > Sergey, > > > > Thanks for the patch, nice catch! I guess we missed this bug since the > > tests do not cover the case for GCcdata object with a custom finalizer. > > But these are frequently used in Tarantool though. The changes LGTM, > > except several nits below. > > > > On 16.02.21, Sergey Kaplun wrote: > > > When cdata has custom finalizer (and so LJ_GC_CDATA_FIN flag) it is not > > > collected immediately, when lj_cdata_free() is called. Instead, it is > > > resurrected and marked finalized, so it is collected at the next GC > > > > Minor: AFAIR, the payload is released (or finalized in LuaJIT terms) at > > the current GC cycle. Hence, the GCobject is marked finalized at this > > cycle too, but it is processed once more at the next one to be released. > > Yes, as you said below: it is made white (is resurrected) in sweep phase > and finalized additional payload in GCfinalize phase. The cdata > object is collected at the next GC cycle. > > I haven't change commit message since it means the same. Please > correct me if I'm missing something. You may update this commit > message in way what you want during cherry picking. Sorry, you're right and v buhgalterii vse pereputali. I left the commit message unchanged. > > > > > > cycle. The reason of the bug is that gc_cdatanum is decremented when > > > cdata is resurrected too (i.e. twice). > > > > > > This patch excludes cdata decrementing from resurrection branch and > > > adds corresponding tests. > > > > > > Resolves tarantool/tarantool#5820 > > > Follows up tarantool/tarantool#5187 > > > --- > > > > > > Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-5820-improperly-cdata-counting > > > Test Branch: https://github.com/tarantool/tarantool/tree/skaplun/gh-5820-improperly-cdata-counting > > > Issue: https://github.com/tarantool/tarantool/issues/5820 > > > > > > ChangeLog entry for bumping LuaJIT: > > > =================================================================== > > > ## bugfix/LuaJIT > > > > > > * Fix double cdata decrementing in platform metrics when finalizer is set (gh-5820). > > > =================================================================== > > > > > > src/lj_cdata.c | 3 +- > > > test/misclib-getmetrics-capi.test.lua | 15 +++++++++- > > > test/misclib-getmetrics-capi/testgetmetrics.c | 28 +++++++++++++++++++ > > > test/misclib-getmetrics-lapi.test.lua | 15 +++++++++- > > > 4 files changed, 58 insertions(+), 3 deletions(-) > > > > Side note: It's worth to check whether Tarantool internals do not spoil > > the counters the same way they do after making LuaJIT testing machinery > > self-sufficient. There is call at the beginning of the > > test, but I haven't tested your patch against my series. > > I've checked it at the new branch version: > https://github.com/tarantool/tarantool/tree/skaplun/gh-5820-improperly-cdata-counting > Looks OK. Yes, CI is green and this is great. Thanks for checking! > > > -- > Best regards, > Sergey Kaplun -- Best regards, IM