From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp57.i.mail.ru (smtp57.i.mail.ru [217.69.128.37]) (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 3B5804696C6 for ; Sun, 23 Feb 2020 20:43:59 +0300 (MSK) References: <6ea1b78d9b2ddf8a56d39391c14262103b35d26c.1582119629.git.korablev@tarantool.org> From: Vladislav Shpilevoy Message-ID: <33767c0b-2bb6-8bf3-87a5-d3b1994f05d0@tarantool.org> Date: Sun, 23 Feb 2020 18:43:58 +0100 MIME-Version: 1.0 In-Reply-To: <6ea1b78d9b2ddf8a56d39391c14262103b35d26c.1582119629.git.korablev@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 5/7] box/error: clarify purpose of reference counting in struct error List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik , tarantool-patches@dev.tarantool.org Thanks for the patch! How about merging this commit into the previous one? On 19/02/2020 15:16, Nikita Pettik wrote: > --- > src/lib/core/diag.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/lib/core/diag.h b/src/lib/core/diag.h > index 5271733cb..a9181c522 100644 > --- a/src/lib/core/diag.h > +++ b/src/lib/core/diag.h > @@ -72,6 +72,15 @@ struct error { > error_f raise; > error_f log; > const struct type_info *type; > + /** > + * Reference counting is basically required since > + * instances of this structure are available in Lua > + * as well (as cdata with overloaded fields and methods > + * by the means of introspection). Thus, it may turn > + * out that Lua's GC attempts at releasing object > + * meanwhile it is still used in C internals or vice > + * versa. For details see luaT_pusherror(). Hmm, no, it can't anymore. Lua can't delete an error object, if it is still used in C. This looks like an artifact from the previous patch version, were you unreferenced all errors when diag was cleared. > + */ > int refs; > /** > * Errno at the moment of the error >