From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id D9C992DAE3 for ; Thu, 25 Oct 2018 05:58:38 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zubngqdoebgj for ; Thu, 25 Oct 2018 05:58:38 -0400 (EDT) Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 47C2E2DA87 for ; Thu, 25 Oct 2018 05:58:38 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH] Fix tuple cdata collecting Date: Thu, 25 Oct 2018 12:58:37 +0300 Message-Id: <20181025095837.6063-1-georgy@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org 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