If we say that memory.used of fiber should be 0 (or the same) at the start and at the end of each test than it may be good idea to check that automatically.
One such problem was detected through failing of sql/gh-3199-no-mem-leaks.test.lua: if we add mentioned check to test sql/iproto.test.lua we will see:
[001] Test failed! Result content mismatch:
[001] --- sql/iproto.result Mon Oct 29 20:17:57 2018
[001] +++ sql/iproto.reject Mon Oct 29 23:10:38 2018
[001] @@ -7,8 +7,15 @@
[001] engine = test_run:get_cfg('engine')
[001] ---
[001] ...
[001] +fiber = require('fiber')
[001] +---
[001] +...
[001] box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
[001] ---
[001] +...
[001] +fiber.info()[fiber.self().id()].memory.used
[001] +---
[001] +- 0
[001] ...
[001] box.sql.execute('create table test (id primary key, a float, b text)')
[001] ---
[001] @@ -591,3 +598,7 @@
[001] ---
[001] - ok
[001] ...
[001] +fiber.info()[fiber.self().id()].memory.used
[001] +---
[001] +- 6240
[001] +...
Diff to reproduce:
diff --git a/test-run b/test-run
index 670f330..b8764e1 160000
--- a/test-run
+++ b/test-run
@@ -1 +1 @@
-Subproject commit 670f330aacaf44bc8b1f969fa0cd5f811c5ceb1b
+Subproject commit b8764e17ccc79a26d1e661a0aaeaad90bd0aa1ea
diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
index 220331b..3065fca 100644
--- a/test/sql/iproto.test.lua
+++ b/test/sql/iproto.test.lua
@@ -1,8 +1,10 @@
remote = require('net.box')
test_run = require('test_run').new()
engine = test_run:get_cfg('engine')
+fiber = require('fiber')
box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+fiber.info()[fiber.self().id()].memory.used
box.sql.execute('create table test (id primary key, a float, b text)')
space = box.space.TEST
space:replace{1, 2, '3'}
@@ -207,3 +209,4 @@ space = nil
-- Cleanup xlog
box.snapshot()
+fiber.info()[fiber.self().id()].memory.used
Last commit in current master(2.1):
https://github.com/tarantool/tarantool/commit/e5834e43350becf3186a0428bec07535a44111de
If we say that memory.used of fiber should be 0 (or the same) at the start and at the end of each test than it may be good idea to check that automatically.
One such problem was detected through failing of sql/gh-3199-no-mem-leaks.test.lua: if we add mentioned check to test sql/iproto.test.lua we will see:
Diff to reproduce:
Last commit in current master(2.1):