Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Fix tuple cdata collecting
@ 2018-10-25  9:58 Georgy Kirichenko
  2018-10-26 13:04 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Georgy Kirichenko @ 2018-10-25  9:58 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Georgy Kirichenko

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-26 13:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-25  9:58 [tarantool-patches] [PATCH] Fix tuple cdata collecting Georgy Kirichenko
2018-10-26 13:04 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox