Skip to content

Memleak of FiberIsCancelled exception #10733

@Buristan

Description

@Buristan

On the commit

git log --oneline --no-decorate -n1
c10c62927e box/lua: change space:bsize() return type from cdata to number

How to reporoduce the issue:
Apply the following patch if you want to run all tests via make LuaJIT-test

diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index 58552a049f..f486dde9ee 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -39,7 +39,7 @@ set(LUAJIT_SMART_STRINGS ON CACHE BOOL
     "Harder string hashing function" FORCE)
 set(LUAJIT_TEST_BINARY $<TARGET_FILE:tarantool> CACHE STRING
     "Lua implementation to be used for tests (tarantool)" FORCE)
-set(LUAJIT_USE_TEST OFF CACHE BOOL
+set(LUAJIT_USE_TEST ON CACHE BOOL
     "Generate <test> target" FORCE)
 
 # XXX: There is <strict> module enabled by default in Tarantool
CC=clang CXX=clang++ cmake -DENABLE_FUZZER=ON -DCMAKE_BUILD_TYPE=Debug -DFIBER_STACK_SIZE=1048576 -DENABLE_BACKTRACE=ON -DENABLE_DIST=ON -DENABLE_BUNDLED_LIBCURL=OFF . && make -j

FIBER_STACK_SIZE is increased to avoid stack overflow for some corner cases when parsing nested structures.

Run make tarantool-tests or the following command:

LUA_PATH="third_party/luajit/test/tarantool-tests/?/init.lua;third_party/luajit/test/tarantool-tests/?.lua;;" src/tarantool -e 'dofile[[test/luajit-test-init.lua]]' third_party/luajit/test/tarantool-tests/lj-1034-tabov-error-frame.test.lua

The actual output is the following (the test runs 7-10 minutes on my machine and consumes ~6-8Gb of memory, so take your time):

TAP version 13
1..2
ok - error handled successfully
ok - error is table overflow

=================================================================
==32239==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 872 byte(s) in 1 object(s) allocated from:
    #0 0x55eb483b6ae3 in malloc /var/tmp/portage/sys-libs/compiler-rt-sanitizers-18.1.8-r1/work/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x55eb4990d8b0 in Exception::operator new(unsigned long) /home/burii/builds_workspace/tarantool/master/src/lib/core/exception.cc:90:9
    #2 0x55eb499130ba in BuildFiberIsCancelled /home/burii/builds_workspace/tarantool/master/src/lib/core/exception.cc:322:9
    #3 0x55eb496f8736 in luaL_testcancel /home/burii/builds_workspace/tarantool/master/src/lua/fiber.c:48:3
    #4 0x55eb496ffc85 in lbox_fiber_stall /home/burii/builds_workspace/tarantool/master/src/lua/fiber.c:925:2
    #5 0x55eb49b04118 in lj_BC_FUNCC /home/burii/builds_workspace/tarantool/master/third_party/luajit/src/lj_vm.S:852

SUMMARY: AddressSanitizer: 872 byte(s) leaked in 1 allocation(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    asanbugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions