New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua: <key_def_object>:compare_with_key() may leak a tuple #5388
Comments
To be fixed by using non-throwing |
Totktonada
added a commit
to tarantool/tuple-keydef
that referenced
this issue
Oct 10, 2020
Aside of this, added validation of its return value. Borrowed the test case from fix of the issue [1]. [1]: tarantool/tarantool#5388
Totktonada
added a commit
to tarantool/tuple-keydef
that referenced
this issue
Oct 19, 2020
Aside of this, added validation of its return value. Borrowed the test case from fix of the issue [1]. [1]: tarantool/tarantool#5388
Totktonada
added a commit
that referenced
this issue
Mar 23, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure. The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388
Totktonada
added a commit
that referenced
this issue
Mar 23, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure. The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388
Totktonada
added a commit
that referenced
this issue
Mar 29, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. Aside of the tuple leak, the patch fixes fiber region's memory 'leak' (till fiber_gc()). Before the patch, the memory that is used for serialization of the key is not freed (region_truncate()) when the serialization fails. It is verified in the gh-5388-<...> test. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure (added into key_def.test.lua). The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the tuple leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388
Totktonada
added a commit
that referenced
this issue
Apr 1, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. Aside of the tuple leak, the patch fixes fiber region's memory 'leak' (till fiber_gc()). Before the patch, the memory that is used for serialization of the key is not freed (region_truncate()) when the serialization fails. It is verified in the gh-5388-<...> test. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure (added into key_def.test.lua). The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the tuple leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388
kyukhin
pushed a commit
that referenced
this issue
Apr 5, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. Aside of the tuple leak, the patch fixes fiber region's memory 'leak' (till fiber_gc()). Before the patch, the memory that is used for serialization of the key is not freed (region_truncate()) when the serialization fails. It is verified in the gh-5388-<...> test. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure (added into key_def.test.lua). The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the tuple leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388
kyukhin
pushed a commit
that referenced
this issue
Apr 5, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. Aside of the tuple leak, the patch fixes fiber region's memory 'leak' (till fiber_gc()). Before the patch, the memory that is used for serialization of the key is not freed (region_truncate()) when the serialization fails. It is verified in the gh-5388-<...> test. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure (added into key_def.test.lua). The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the tuple leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388 (cherry picked from commit db766c5)
kyukhin
pushed a commit
that referenced
this issue
Apr 5, 2021
The key difference between lbox_encode_tuple_on_gc() and luaT_tuple_encode() is that the latter never raises a Lua error, but passes an error using the diagnostics area. Aside of the tuple leak, the patch fixes fiber region's memory 'leak' (till fiber_gc()). Before the patch, the memory that is used for serialization of the key is not freed (region_truncate()) when the serialization fails. It is verified in the gh-5388-<...> test. While I'm here, added a test case that just verifies correct behaviour in case of a key serialization failure (added into key_def.test.lua). The case does not verify whether a tuple leaks and it is successful as before this patch as well after the patch. I don't find a simple way to check the tuple leak within a test. Verified manually using the reproducer from the linked issue. Fixes #5388 (cherry picked from commit db766c5)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tarantool version: 2.6.0-136-g2711797be.
Case (constructed similarly to one from #5382).
Code:
tarantool/src/box/lua/key_def.c
Lines 352 to 359 in 2711797
The function
lbox_encode_tuple_on_gc()
raises a Lua error at a serialization failure (forkey
) and so a tuple created or referenced inluaT_key_def_check_tuple()
will leak.The text was updated successfully, but these errors were encountered: