Memory leaks in gen_lex_hash.cc

Bug #1386157 reported by Alexey Kopytov on 2014-10-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
Low
Alexey Kopytov
2.2
Fix Released
Low
Alexey Kopytov
2.3
Fix Released
Low
Alexey Kopytov

Bug Description

Duplicating the upstream report http://bugs.mysql.com/bug.php?id=74540 since it also affects PXB ASAN builds:

When creating an AddressSanitizer/LeakSanitizer (i.e. -DWITH_ASAN=on) enabled server build on Ubuntu Utopic, the following memory leaks are reported in gen_lex_hash.cc:

18:01:03
18:01:03 =================================================================
18:01:03 ==17392==ERROR: LeakSanitizer: detected memory leaks
18:01:03
18:01:03 Direct leak of 13792 byte(s) in 1 object(s) allocated from:
18:01:03 #0 0x7f879d6b2a96 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x57a96)
18:01:03 #1 0x401ab9 in add_struct_to_map(hash_lex_struct*) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:239
18:01:03 #2 0x401d5b in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:261
18:01:03 #3 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #4 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #5 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #6 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #7 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #8 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:265
18:01:03 #9 0x4021a0 in print_find_structs() /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:310
18:01:03 #10 0x400ca2 in main /mnt/workspace/percona-xtrabackup-2.2-param/BUILD_TYPE/release/Host/asan/xtrabackuptarget/innodb55/sql/gen_lex_hash.cc:394
18:01:03 #11 0x7f879d2b7ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
18:01:03
18:01:03 SUMMARY: AddressSanitizer: 13792 byte(s) leaked in 1 allocation(s).
18:01:03 sql/CMakeFiles/GenServerSource.dir/build.make:61: recipe for target 'sql/lex_hash.h' failed

Indeed, there's a number of malloc()/realloc() calls, but the allocated memory is never freed. This becomes a problem, because gen_lex_hash is executed as a part of the build process.

How to repeat:
Build with the "-DWITH_ASAN=on" CMake flag on a Ubuntu Utopic machine. I'm not sure if the leak sanitizer is enabled by default, so "export ASAN_OPTIONS=detect_leaks=1" may also be necessary.

Related branches

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-927

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.