From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maksim Kokryashkin <max.kokryashkin@gmail.com> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Fix last commit. Date: Wed, 1 Nov 2023 11:56:42 +0300 [thread overview] Message-ID: <ZUISyj6SX7ppVtKJ@root> (raw) In-Reply-To: <20231027125738.29527-3-max.kokryashkin@gmail.com> Hi, Maxim! Thanks for the patch! LGTM, just a few nits below. On 27.10.23, Maksim Kokryashkin wrote: > From: Mike Pall <mike> > > Reported by PluMGMK. > > (cherry-picked from commit 224129a8e64bfa219d35cd03055bf03952f167f6) > > The error handler for GC finalizers was not cleared from the It's not a handler itself, but "_VMEVENTS" table, where the handler is registered. > stack after the initialization. This commit adds stack cleanup. > > Maxim Kokryashkin: > * added the description and the test for the problem > > Part of tarantool/tarantool#9145 > --- > src/lib_aux.c | 2 ++ > .../fix-finalizer-error-handler-init.test.c | 30 +++++++++++++++++++ > 2 files changed, 32 insertions(+) > create mode 100644 test/tarantool-c-tests/fix-finalizer-error-handler-init.test.c > > diff --git a/src/lib_aux.c b/src/lib_aux.c > index d532a12f..ecdc67f9 100644 > --- a/src/lib_aux.c > +++ b/src/lib_aux.c <snipped> > diff --git a/test/tarantool-c-tests/fix-finalizer-error-handler-init.test.c b/test/tarantool-c-tests/fix-finalizer-error-handler-init.test.c > new file mode 100644 > index 00000000..44c1d96b > --- /dev/null > +++ b/test/tarantool-c-tests/fix-finalizer-error-handler-init.test.c Please, add "lj-991-" prefix and mention the issue in the comment below. > @@ -0,0 +1,30 @@ > +#include "lua.h" > +#include "test.h" > +#include "utils.h" > + > +#include "lj_obj.h" > + > +/* > + * This test demonstrates an uncleared Lua stack after the > + * initialization of the error handler for GC finalizers. > + */ > + > +static int stack_is_clean(void *test_state) > +{ > + lua_State *L = test_state; > + assert_ptr_equal(L->top, L->base); I suppose, that there is no need for internals to be used here. We can just use `lua_gettop(L)` and compare its result to 0. Side note: Also, this helper may be usefull later. See also the comment in [1]. > + return TEST_EXIT_SUCCESS; > +} > + > +int main(void) > +{ > + lua_State *L = utils_lua_init(); > + > + const struct test_unit tgroup[] = { > + test_unit_def(stack_is_clean) > + }; > + > + const int test_result = test_run_group(tgroup, L); > + utils_lua_close(L); > + return test_result; > +} > -- > 2.39.3 (Apple Git-145) > [1]: https://github.com/LuaJIT/LuaJIT/commit/03cd5aa7 -- Best regards, Sergey Kaplun
prev parent reply other threads:[~2023-11-01 9:01 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-27 12:57 [Tarantool-patches] [PATCH luajit 0/2] gc: handle errors in finalizers Maksim Kokryashkin via Tarantool-patches 2023-10-27 12:57 ` [Tarantool-patches] [PATCH luajit 1/2] Print errors from __gc finalizers instead of rethrowing them Maksim Kokryashkin via Tarantool-patches 2023-11-01 8:15 ` Sergey Kaplun via Tarantool-patches 2023-10-27 12:57 ` [Tarantool-patches] [PATCH luajit 2/2] Fix last commit Maksim Kokryashkin via Tarantool-patches 2023-11-01 8:56 ` Sergey Kaplun via Tarantool-patches [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ZUISyj6SX7ppVtKJ@root \ --to=tarantool-patches@dev.tarantool.org \ --cc=max.kokryashkin@gmail.com \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 2/2] Fix last commit.' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox