[MDEV-30680] Warning: Memory not freed: 280 on mangled query, LeakSanitizer: detected memory leaks Created: 2023-02-18 Updated: 2023-07-18 Resolved: 2023-06-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Stored routines |
| Affects Version/s: | 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1 |
| Fix Version/s: | 10.8.8, 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Roel Van de Paar | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | LSAN, Memory_leak, regression-10.5 | ||
| Issue Links: |
|
||||||||||||
| Description |
|
Present in 10.5+ only, both in debug and optimized.
Leads to (ref error log after shutdown):
In all affected versions. No UBSAN/ASAN issues observed. I tried to make this work under MTR for some time, but failed. AFAICS ftm, this issue can only be reproduced in a client, not in MTR, not even when using the CLI via MTR i.e. --start-and-exit. As such, you will need to start mariadbd and then mariadb manually/directly to reproduce. |
| Comments |
| Comment by Roel Van de Paar [ 2023-05-13 ] | ||||||||||||||||||||||||||||||
|
Additional testcase now gives LeakSanitizer: detected memory leaks, likely from sp_add_used_routine. Again has to be reproduced in CLI.
Leads to:
| ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-05-15 ] | ||||||||||||||||||||||||||||||
|
Can be reproduced using this MTR test:
The output is:
Note, warnings are reproducible even with a simple -DCMAKE_BUILD_TYPE=Debug build (-DWITH_UBSAN=1 is not needed). | ||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-05-15 ] | ||||||||||||||||||||||||||||||
|
bar Nice, thank you! Yes, -DWITH_ASAN=1 (LSAN is part of ASAN) is not needed, however when used it provides the full relevant stack trace. | ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-05-15 ] | ||||||||||||||||||||||||||||||
|
Also repeatable with direct execution (instead of EXECUTE IMMEDIATE):
| ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-05-15 ] | ||||||||||||||||||||||||||||||
|
The problem is also repeatable with the following scripts:
| ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-05-15 ] | ||||||||||||||||||||||||||||||
|
Hi dshulga, can you please review a patch: https://github.com/MariaDB/server/commit/cb334ae07f5286198b9d5d15eb4f908cac5af7fc Thanks! | ||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-06-08 ] | ||||||||||||||||||||||||||||||
|
shulga Could you have a look at the patch please? We see this error somewhat regularly in testing. Thank you! | ||||||||||||||||||||||||||||||
| Comment by Roel Van de Paar [ 2023-06-14 ] | ||||||||||||||||||||||||||||||
|
Please also test
Against LSAN.
| ||||||||||||||||||||||||||||||
| Comment by Dmitry Shulga [ 2023-06-20 ] | ||||||||||||||||||||||||||||||
|
The patch approved | ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-06-22 ] | ||||||||||||||||||||||||||||||
|
The problem is also repeatable with:
It's now reported as a separate issue | ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-06-22 ] | ||||||||||||||||||||||||||||||
|
The new patch is here: https://github.com/MariaDB/server/commit/575ab6d3fd8d2d311d55391d54f3f665c3ae07ac |