<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Hi, Sergey,</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 6/6/25 17:03, Sergey Kaplun wrote:<br>
</div>
<blockquote type="cite" cite="mid:aEL1Q41tevjyXHSk@root">
<pre wrap="" class="moz-quote-pre">Hi, Sergey!
Thanks for the review!
Please consider my answers below.
On 06.06.25, Sergey Bronnikov wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">Hello, Sergey,
Thanks for the patch! See my comments below.
On 6/5/25 08:44, Sergey Kaplun wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">This patch adds a new field, track-fds [1], in the Valgrind workflow
matrix to detect descriptor leakage in the tests.
[1]:<a class="moz-txt-link-freetext" href="https://valgrind.org/docs/manual/manual-core.html#opt.track-fds">https://valgrind.org/docs/manual/manual-core.html#opt.track-fds</a>
Needed for tarantool/tarantool#11278
---
.github/workflows/valgrind-testing.yaml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/valgrind-testing.yaml b/.github/workflows/valgrind-testing.yaml
index e6606478..b3c7bc80 100644
--- a/.github/workflows/valgrind-testing.yaml
+++ b/.github/workflows/valgrind-testing.yaml
@@ -38,7 +38,11 @@ jobs:
# Therefore, testing on this platform is currently
# disabled.
BUILDTYPE: [Debug, Release]
- VALGRIND_SCENARIO: [full, malloc-free-fill-0x00, malloc-free-fill-0xff]
+ VALGRIND_SCENARIO:
+ - full
+ - malloc-free-fill-0x00
+ - malloc-free-fill-0xff
+ - track-fds
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">Why we cannot add "track-fds" to the existed scenario?
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
I've thought to add this flag to the "full" scenario. But then I
realized that we already have "full" workflow running too long, and the
parallel shorter task will not slow the CI, I suppose.
</pre>
</blockquote>
Ok.<br>
<blockquote type="cite" cite="mid:aEL1Q41tevjyXHSk@root">
<pre wrap="" class="moz-quote-pre">
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre"> include:
- BUILDTYPE: Debug
CMAKEFLAGS: -DCMAKE_BUILD_TYPE=Debug -DLUA_USE_ASSERT=ON -DLUA_USE_APICHECK=ON
@@ -59,6 +63,9 @@ jobs:
- VALGRIND_SCENARIO: malloc-free-fill-0xff
VALGRIND_OPTS: --leak-check=no --malloc-fill=0xff --free-fill=0xff
JOB_POSTFIX: "malloc/free-fill: 0xff"
+ - VALGRIND_SCENARIO: track-fds
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
According to documentation, the option "print out a list of open file
descriptors on exit or on request".
So the fd leak detection is semi-automated. How it should work on CI?
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">
The fd not checked on exit without this flag. I suppose the wording in
the Valgrind's documentation isn't perfect.
You may test it locally with and without the corresponding flag in
the`VALGRIND_OPTS` env variable.
</pre>
</blockquote>
<p>FD leak is detected but test is passed:</p>
<p><br>
</p>
<p>UpdateCTestConfiguration from
:/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/DartConfiguration.tcl<br>
UpdateCTestConfiguration from
:/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/DartConfiguration.tcl<br>
Test project
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64<br>
Constructing a list of tests<br>
Done constructing a list of tests<br>
Updating test list for fixtures<br>
Added 0 tests to meet fixture requirements<br>
Checking test dependency graph...<br>
Checking test dependency graph end<br>
test 154<br>
Start 154:
test/tarantool-tests/lj-1249-loadfile-fd-leak.test.lua<br>
<br>
154: Test command: /bin/valgrind "--leak-check=no"
"--track-fds=yes" "--error-exitcode=1"
"--suppressions=/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/lj.supp"
"--suppressions=/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/lj_extra.supp"
"/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/src/luajit"
"-e"
"dofile[[/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/luajit-test-init.lua]]"
"/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-tests/lj-1249-loadfile-fd-leak.test.lua"<br>
154: Working Directory:
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/test/tarantool-tests<br>
154: Environment variables: <br>
154:
LUA_PATH=/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-tests/?.lua;/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-tests/?/init.lua;/home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/?.lua;/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/src/?.lua;;<br>
154: LUAJIT_TEST_USE_VALGRIND=1<br>
154:
LUA_CPATH=/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/test/tarantool-tests/utils/?.so;<br>
154:
LD_LIBRARY_PATH=/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/test/tarantool-tests/utils:<br>
154: Test timeout computed to be: 10000000<br>
154: ==2176604== Memcheck, a memory error detector<br>
154: ==2176604== Copyright (C) 2002-2022, and GNU GPL'd, by Julian
Seward et al.<br>
154: ==2176604== Using Valgrind-3.22.0 and LibVEX; rerun with -h
for copyright info<br>
154: ==2176604== Command:
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/src/luajit
-e
dofile[[/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/luajit-test-init.lua]]
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-tests/lj-1249-loadfile-fd-leak.test.lua<br>
154: ==2176604== <br>
154: TAP version 13<br>
154: 1..4<br>
154: ok - correct status, OOM on filename creation<br>
154: ok - correct error message, OOM on filename creation<br>
154: ok - correct status, OOM on error message creation<br>
154: ok - correct error message, OOM on error message creation<br>
154: ==2176604== <br>
154: ==2176604== FILE DESCRIPTORS: 5 open (3 std) at exit.<br>
154: ==2176604== Open file descriptor 4: /dev<br>
154: ==2176604== at 0x4ABB175: open (<a class="moz-txt-link-freetext" href="open64.c:41">open64.c:41</a>)<br>
154: ==2176604== by 0x4A31B0E: _IO_file_open (<a class="moz-txt-link-freetext" href="fileops.c:188">fileops.c:188</a>)<br>
154: ==2176604== by 0x4A31E51: _IO_file_fopen@@GLIBC_2.2.5
(<a class="moz-txt-link-freetext" href="fileops.c:281">fileops.c:281</a>)<br>
154: ==2176604== by 0x4A25EE1: __fopen_internal (<a class="moz-txt-link-freetext" href="iofopen.c:75">iofopen.c:75</a>)<br>
154: ==2176604== by 0x4A25EE1: <a class="moz-txt-link-abbreviated" href="mailto:fopen@@GLIBC_2.2.5">fopen@@GLIBC_2.2.5</a>
(<a class="moz-txt-link-freetext" href="iofopen.c:86">iofopen.c:86</a>)<br>
154: ==2176604== by 0x1FAB1E: luaL_loadfilex (src/lj_<a class="moz-txt-link-freetext" href="load.c:92">load.c:92</a>)<br>
154: ==2176604== by 0x217F18: lj_cf_loadfile
(src/lib_<a class="moz-txt-link-freetext" href="base.c:384">base.c:384</a>)<br>
154: ==2176604== by 0x2A19B9: lj_BC_FUNCC
(/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/src/lj_<a class="moz-txt-link-freetext" href="vm.S:899">vm.S:899</a>)<br>
154: ==2176604== by 0x1E7C81: lua_pcall (src/lj_<a class="moz-txt-link-freetext" href="api.c:1173">api.c:1173</a>)<br>
154: ==2176604== by 0x1D738F: docall (src/<a class="moz-txt-link-freetext" href="luajit.c:134">luajit.c:134</a>)<br>
154: ==2176604== by 0x1D6E56: handle_script (src/<a class="moz-txt-link-freetext" href="luajit.c:304">luajit.c:304</a>)<br>
154: ==2176604== by 0x1D615B: pmain (src/<a class="moz-txt-link-freetext" href="luajit.c:602">luajit.c:602</a>)<br>
154: ==2176604== by 0x2A19B9: lj_BC_FUNCC
(/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/src/lj_<a class="moz-txt-link-freetext" href="vm.S:899">vm.S:899</a>)<br>
154: ==2176604== <br>
154: ==2176604== Open file descriptor 3:
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/build/gc64/Testing/Temporary/LastTest.log.tmp<br>
154: ==2176604== <inherited from parent><br>
154: ==2176604== <br>
154: ==2176604== <br>
154: ==2176604== HEAP SUMMARY:<br>
154: ==2176604== in use at exit: 472 bytes in 1 blocks<br>
154: ==2176604== total heap usage: 1,253 allocs, 1,252 frees,
179,771 bytes allocated<br>
154: ==2176604== <br>
154: ==2176604== For a detailed leak analysis, rerun with:
--leak-check=full<br>
154: ==2176604== <br>
154: ==2176604== For lists of detected and suppressed errors,
rerun with: -s<br>
154: ==2176604== ERROR SUMMARY: 0 errors from 0 contexts
(suppressed: 67 from 18)<br>
1/1 Test #154:
test/tarantool-tests/lj-1249-loadfile-fd-leak.test.lua ...
Passed 0.77 sec<br>
<br>
The following tests passed:<br>
test/tarantool-tests/lj-1249-loadfile-fd-leak.test.lua<br>
<br>
100% tests passed, 0 tests failed out of 1<br>
<br>
Label Time Summary:<br>
tarantool-tests = 0.77 sec*proc (1 test)<br>
<br>
Total Test time (real) = 0.79 sec<br>
</p>
<blockquote type="cite" cite="mid:aEL1Q41tevjyXHSk@root">
<pre wrap="" class="moz-quote-pre">
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">+ VALGRIND_OPTS: --leak-check=no --track-fds=yes
+ JOB_POSTFIX: "track-fds"
runs-on: [self-hosted, regular, Linux, x86_64]
name: >
LuaJIT with Valgrind (Linux/x86_64)
</pre>
</blockquote>
</blockquote>
<pre wrap="" class="moz-quote-pre">
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>