Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/2] Fix VM event error handling for finalizers.
Date: Mon, 30 Mar 2026 12:44:58 +0300	[thread overview]
Message-ID: <acpGGqOZs9jGwJss@root> (raw)
In-Reply-To: <d23eb125-1d6e-4405-a629-c040f4d51cec@tarantool.org>

Hi, Sergey!
Thanks for the review!
Fixed the comments and force-pushed the branch.

On 30.03.26, Sergey Bronnikov wrote:
> Hi, Sergey!
> 
> thanks for the patch! LGTM with a couple of comments below
> 
> Sergey
> 
> On 3/28/26 18:31, Sergey Kaplun wrote:

<snipped>

> > diff --git a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
> > new file mode 100644
> > index 00000000..def8b79c
> > --- /dev/null
> > +++ b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
> > @@ -0,0 +1,27 @@
> > +local tap = require('tap')
> > +local test = tap.test('lj-1445-errfin-errmsg')
> > +
> 
> Usually you add a comment with test description and a link to the issue.
> 
> But this time a comment is absent. Should we add it?

Added, thanks!

===================================================================
diff --git a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
index 7170065f..a52f6a06 100644
--- a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
+++ b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
@@ -1,4 +1,9 @@
 local tap = require('tap')
+
+-- The test file to demostrate LuaJIT's incorrect invocation of
+-- the VM event handler for the 'errfin' VM event.
+-- See also: https://github.com/LuaJIT/LuaJIT/issues/1445.
+
 local test = tap.test('lj-1445-errfin-errmsg')
 
 test:plan(2)
===================================================================

> 
> > +test:plan(2)
> > +
> > +local EXPECTED_ERR = 'expected err'
> 
> s/err/error/

Fixed:
===================================================================
diff --git a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
index def8b79c..205cd2d0 100644
--- a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
+++ b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
@@ -3,7 +3,7 @@ local test = tap.test('lj-1445-errfin-errmsg')
 
 test:plan(2)
 
-local EXPECTED_ERR = 'expected err'
+local EXPECTED_ERR = 'expected error'
 local function bad_fin()
   error(EXPECTED_ERR)
 end
===================================================================

> 
> feel free to ignore
> 
> > +local function bad_fin()
> > +  error(EXPECTED_ERR)
> > +end
> > +local EXPECTED_LOCATION = debug.getinfo(bad_fin).linedefined + 1
> > +
> > +local match_err = false
> > +local match_line = false
> > +local function errfin_handler(errmsg)
> > +  match_err =errmsg:match(EXPECTED_ERR)
> > +  match_line =errmsg:match(EXPECTED_LOCATION)
> > +end
> > +
> > +jit.attach(errfin_handler, 'errfin')
> > +
> > +debug.getmetatable(newproxy(true)).__gc = bad_fin
> 
> I would define userdata previously for clarity:
> 
> local ud = newproxy(true)
> 
> and then use it in getmetatable().
> 
> feel free to ignore
> 

Don't want to use `ud = nil`. Added the comment.

===================================================================
diff --git a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
index def8b79c..205cd2d0 100644
--- a/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
+++ b/test/tarantool-tests/lj-1445-errfin-errmsg.test.lua
@@ -18,6 +18,7 @@ end
 
 jit.attach(errfin_handler, 'errfin')
 
+-- Create the userdata with the finalizer and collect it.
 debug.getmetatable(newproxy(true)).__gc = bad_fin
 collectgarbage()
===================================================================

> 
> > +collectgarbage()
> > +
> > +test:ok(match_err, 'correct error message in errfin handler')
> > +test:ok(match_line, 'correct source line in errfin handler')
> > +
> > +test:done(true)

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2026-03-30  9:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-28 15:31 [Tarantool-patches] [PATCH luajit 0/2] VM events and finalizers in separate state Sergey Kaplun via Tarantool-patches
2026-03-28 15:31 ` [Tarantool-patches] [PATCH luajit 1/2] Run " Sergey Kaplun via Tarantool-patches
2026-03-30  7:58   ` Sergey Bronnikov via Tarantool-patches
2026-03-30  9:38     ` Sergey Kaplun via Tarantool-patches
2026-03-30 11:06       ` Sergey Bronnikov via Tarantool-patches
2026-03-28 15:31 ` [Tarantool-patches] [PATCH luajit 2/2] Fix VM event error handling for finalizers Sergey Kaplun via Tarantool-patches
2026-03-30  8:08   ` Sergey Bronnikov via Tarantool-patches
2026-03-30  9:44     ` Sergey Kaplun via Tarantool-patches [this message]
2026-03-30 11:07       ` Sergey Bronnikov via Tarantool-patches

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=acpGGqOZs9jGwJss@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/2] Fix VM event error handling for finalizers.' \
    /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