From: Georgy Kirichenko <georgy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] [PATCH] Fix tuple cdata collecting
Date: Thu, 25 Oct 2018 12:58:37 +0300 [thread overview]
Message-ID: <20181025095837.6063-1-georgy@tarantool.org> (raw)
In some cases luajit does not collect cdata objects which where
transformed with ffi.cast as tuple_bless does. In consequence, internal
table with gc callback overflows and then lua crashes. There might be an
internal luajit issue because it fires only for jitted code. But assigning
a gc callback before transformation fixes the problem.
Fixes: #3751
---
https://github.com/tarantool/tarantool/issues/3751
https://github.com/tarantool/tarantool/tree/g.kirichenko/gh-3751-fix-luajit-cdata-gc
src/box/lua/tuple.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/box/lua/tuple.lua b/src/box/lua/tuple.lua
index 63ea73e43..8662a3a02 100644
--- a/src/box/lua/tuple.lua
+++ b/src/box/lua/tuple.lua
@@ -100,7 +100,7 @@ local tuple_bless = function(tuple)
-- overflow checked by tuple_bless() in C
builtin.box_tuple_ref(tuple)
-- must never fail:
- return ffi.gc(ffi.cast(const_tuple_ref_t, tuple), tuple_gc)
+ return ffi.cast(const_tuple_ref_t, ffi.gc(tuple, tuple_gc))
end
local tuple_check = function(tuple, usage)
--
2.19.1
next reply other threads:[~2018-10-25 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 9:58 Georgy Kirichenko [this message]
2018-10-26 13:04 ` Vladimir Davydov
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=20181025095837.6063-1-georgy@tarantool.org \
--to=georgy@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH] Fix tuple cdata collecting' \
/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