[MDEV-22035] Memory leak in main.mysqltest Created: 2020-03-25 Updated: 2020-04-01 Resolved: 2020-03-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Tests |
| Affects Version/s: | 10.2, 10.5 |
| Fix Version/s: | 10.2.32, 10.3.23, 10.4.13, 10.5.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | ASAN | ||
| Issue Links: |
|
||||
| Description |
|
I debugged the main.mysqltest failure that reliably occurs on kvm-asan. It looks like a bug in GCC 5.4.0’s ASAN implementation to me:
Even if I set a breakpoint on __cxa_finalize () and rerun, I will not get more information. There is only that one thread:
Test setup:
Then, in gdb, type
and finally start the mysqltest client in another gdb:
The arguments are from the $MYSQL_TEST, except for the < foo redirection. Note: If I try to invoke ./mtr main.n on the following n.test file directly, then there is no SIGABRT reported:
It will only report a failure like this:
There is nothing in any log files either:
On my local system, typically using clang version 7, 8, 9, or 10, I have experienced a hang of main.mysqltest since June 2019, on 10.5 and possibly also on 10.4. I finally decided to debug it, and it looks like it could be the same problem. Only, for some reason, the mysqltest process is hanging instead of crashing:
This particular one was built cmake -DWITH_PCRE2=bundled. I have seen (but not debugged) the hang also with the system-provided library. Workaround: Set ASAN_OPTIONS=detect_leaks=0 for the mysqltest invocation, and it will not crash or hang.
|
| Comments |
| Comment by Marko Mäkelä [ 2020-03-25 ] | |||||||||||||||||||||||||||
|
I forgot that LeakSanitizer does not work inside gdb. If I manually invoke the client, then I can get the log to a separate file:
The fix was simple. I have no idea why this is not being reported for older branches than 10.5, even though the leak seems to be there.
| |||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2020-04-01 ] | |||||||||||||||||||||||||||
|
This started to occur on 10.2 as well, so I ported the fix there. |