Bug #74540 | Memory leaks in gen_lex_hash.cc | ||
---|---|---|---|
Submitted: | 24 Oct 2014 9:11 | Modified: | 27 Aug 2015 4:21 |
Reporter: | Alexey Kopytov | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | 5.6, 5.6.21 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[24 Oct 2014 9:11]
Alexey Kopytov
[4 Nov 2014 13:31]
MySQL Verification Team
Hello Alexey Kopytov, Thank you for the report. Confirmed this issue on Ubuntu 14.10 (Utopic Unicorn) with 5.6.21. Thanks, Umesh
[4 Nov 2014 13:32]
MySQL Verification Team
// 5.6.21 on Ubuntu 14 ushastry@ushastry:~/Downloads$ tar -zxvf mysql-5.6.21.tar.gz ushastry@ushastry:~/Downloads/mysql-5.6.21$ export ASAN_OPTIONS=detect_leaks=1 ushastry@ushastry:~/Downloads/mysql-5.6.21$ cmake . -DCMAKE_INSTALL_PREFIX=/home/ushastry/Downloads/mysql-5.6.21 -DWITH_ASAN=on . . -- If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80 -- Library mysqlserver depends on OSLIBS -lpthread;m;crypt;dl -- Configuring done -- Generating done -- Build files have been written to: /home/ushastry/Downloads/mysql-5.6.21 ushastry@ushastry:~/Downloads/mysql-5.6.21$ make Linking CXX executable gen_lex_hash [ 52%] Built target gen_lex_hash Scanning dependencies of target GenServerSource [ 52%] Generating lex_hash.h ================================================================= ==13444==ERROR: LeakSanitizer: detected memory leaks Direct leak of 13792 byte(s) in 1 object(s) allocated from: #0 0x7f69409faa96 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x57a96) #1 0x401ab9 in add_struct_to_map(hash_lex_struct*) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:239 #2 0x401d5b in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:261 #3 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #4 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #5 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #6 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #7 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #8 0x401dd6 in add_structs_to_map(hash_lex_struct*, int) /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:265 #9 0x4021a0 in print_find_structs() /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:310 #10 0x400ca2 in main /home/ushastry/Downloads/mysql-5.6.21/sql/gen_lex_hash.cc:394 #11 0x7f69405ffec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) SUMMARY: AddressSanitizer: 13792 byte(s) leaked in 1 allocation(s). sql/CMakeFiles/GenServerSource.dir/build.make:61: recipe for target 'sql/lex_hash.h' failed make[2]: *** [sql/lex_hash.h] Error 23 CMakeFiles/Makefile2:4719: recipe for target 'sql/CMakeFiles/GenServerSource.dir/all' failed make[1]: *** [sql/CMakeFiles/GenServerSource.dir/all] Error 2 Makefile:143: recipe for target 'all' failed make: *** [all] Error 2 // Other details ushastry@ushastry:~$ cmake --version cmake version 2.8.12.2 ushastry@ushastry:~$ gcc --version gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ushastry@ushastry:~$ cat /etc/*release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.10 DISTRIB_CODENAME=utopic DISTRIB_DESCRIPTION="Ubuntu 14.10" NAME="Ubuntu" VERSION="14.10 (Utopic Unicorn)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 14.10" VERSION_ID="14.10" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
[6 Nov 2014 9:27]
Tor Didriksen
$valgrind --leak-check=full ./sql/gen_lex_hash > /dev/null ==22505== Memcheck, a memory error detector ==22505== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==22505== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==22505== Command: ./sql/gen_lex_hash ==22505== ==22505== ==22505== HEAP SUMMARY: ==22505== in use at exit: 178,960 bytes in 772 blocks ==22505== total heap usage: 8,859 allocs, 8,087 frees, 47,585,056 bytes allocated ==22505== ==22505== 14,152 bytes in 1 blocks are definitely lost in loss record 55 of 59 ==22505== at 0x4C293AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==22505== by 0x401179: add_struct_to_map(hash_lex_struct*) (gen_lex_hash.cc:239) ==22505== by 0x4012F2: add_structs_to_map(hash_lex_struct*, int) (gen_lex_hash.cc:261) ==22505== by 0x40134A: add_structs_to_map(hash_lex_struct*, int) (gen_lex_hash.cc:265) ==22505== by 0x401594: print_find_structs() (gen_lex_hash.cc:310) ==22505== by 0x4018A6: main (gen_lex_hash.cc:394) ==22505== ==22505== LEAK SUMMARY: ==22505== definitely lost: 14,152 bytes in 1 blocks ==22505== indirectly lost: 0 bytes in 0 blocks ==22505== possibly lost: 0 bytes in 0 blocks ==22505== still reachable: 164,808 bytes in 771 blocks ==22505== suppressed: 0 bytes in 0 blocks ==22505== Reachable blocks (those to which a pointer was found) are not shown. ==22505== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==22505== ==22505== For counts of detected and suppressed errors, rerun with: -v ==22505== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
[6 Nov 2014 9:27]
Tor Didriksen
=== modified file 'sql/gen_lex_hash.cc' --- sql/gen_lex_hash.cc revid:tor.didriksen@oracle.com-20141106083604-70jknfa7wafmhslk +++ sql/gen_lex_hash.cc 2014-11-06 09:25:44 +0000 @@ -311,6 +311,7 @@ set_links(root_by_len,max_len); print_hash_map("sql_functions_map"); + free(hash_map); hash_map= 0; size_hash_map= 0;
[27 Aug 2015 4:21]
Erlend Dahl
Duplicate of Bug#76351 gen_lex_hash fails with mem.leak errors if compiled with clang-3.5 + ASAN