From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 67C834765E0 for ; Tue, 22 Dec 2020 20:48:43 +0300 (MSK) Date: Tue, 22 Dec 2020 20:47:57 +0300 From: Sergey Kaplun Message-ID: <20201222174757.GA9101@root> References: <20201222130858.16812-1-skaplun@tarantool.org> <60416D4E-B738-4E6D-A9DB-7D3E678E12C1@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <60416D4E-B738-4E6D-A9DB-7D3E678E12C1@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] lua: avoid panic if HOOK_GC is not active List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Ostanevich Cc: Michael Filonenko , tarantool-patches@dev.tarantool.org Hi, Sergos! Thanks for the review! On 22.12.20, Sergey Ostanevich wrote: > Hi! > > Thanks for the patch! > > Sergos > > > On 22 Dec 2020, at 16:08, Sergey Kaplun wrote: > > > > Panic at fiber.yield() occures inside any active hook. > > > > This is the regression from 96dbc49d097a96af5273cce2b5663db5917f4ea9 > ^^^^^^^^^^ It is a ^^^ caused by Fixed. Thanks! > > > ('lua: prohibit fiber yield when GC hook is active'). > > --- a/src/lua/utils.c > > +++ b/src/lua/utils.c > > @@ -1375,7 +1375,7 @@ void cord_on_yield(void) > > * earlier. As a result fiber switch is prohibited when > > * GC hook is active and the platform is forced to stop. > > */ > > - if (unlikely(g->hookmask & (HOOK_ACTIVE|HOOK_GC))) { > > + if (unlikely(g->hookmask & HOOK_GC)) { > > It can happens the GC hook is not active? Should we have a second test for HOOK_ACTIVE? No, it can't. HOOK_GC always is set with HOOK_ACTIVE inside `gc_call_finalizer()` (see ). Old hook is restored after finalizer's call. > > > struct lua_State *L = fiber()->storage.lua.stack; > I've updated commit message and comments in code considering your and Igor comments. Branch is force-pushed. New commit message is the follows: | lua: avoid panic if HOOK_GC is not an active hook | | Platform panic occurs when fiber.yield() is used within any active | (i.e. being executed now) hook. | | It is a regression caused by 96dbc49d097a96af5273cce2b5663db5917f4ea9 | ('lua: prohibit fiber yield when GC hook is active'). | | This patch fixes false positive panic in cases when VM is not running | a GC hook. | | Relates to #4518 | Closes #5649 | | Reported-by: Michael Filonenko -- Best regards, Sergey Kaplun