server
server copied to clipboard
MDEV-21014: MTR does not detect [A,M,T,L,UB]SAN errors which happen upon server shutdown
- [x] The Jira issue number for this PR is: MDEV-21014
Description
- Patch is allowing to show more traces to mtr stdout from sanitizer
- Patch doesn't output shadow bytes from sanitzer
- Update to patch 42bad56aab25db4a05c676ba99290949ad4e1c34
How can this PR be tested?
Tested with introducing the memory leak in a server and running the test. Example of test:
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
sys_vars.replicate_rewrite_db [ pass ] 26
***Warnings generated in error logs during shutdown after running tests: sys_vars.replicate_rewrite_db
Warning: Memory not freed: 32
==67812==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f6f07a40808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
#1 0x560e474cba0c in my_malloc /home/anel/mariadb/server/src/10.11-source/mysys/my_malloc.c:90
#2 0x560e45508e0f in Rpl_filter::add_string_pair_list(char const*) /home/anel/mariadb/server/src/10.11-source/sql/rpl_filter.cc:546
#3 0x560e45509283 in Rpl_filter::add_rewrite_db(char const*) /home/anel/mariadb/server/src/10.11-source/sql/rpl_filter.cc:604
#4 0x560e455074b1 in Rpl_filter::parse_filter_rule(char const*, int (Rpl_filter::*)(char const*)) /home/anel/mariadb/server/src/10.11-source/sql/rpl_filter.cc:313
#5 0x560e4550972b in Rpl_filter::set_rewrite_db(char const*) /home/anel/mariadb/server/src/10.11-source/sql/rpl_filter.cc:628
#6 0x560e45cde299 in Sys_var_rpl_filter::set_filter_value(char const*, Master_info*) /home/anel/mariadb/server/src/10.11-source/sql/sys_vars.cc:5421
#7 0x560e45cde179 in Sys_var_rpl_filter::global_update(THD*, set_var*) /home/anel/mariadb/server/src/10.11-source/sql/sys_vars.cc:5403
#8 0x560e455139af in sys_var::update(THD*, set_var*) /home/anel/mariadb/server/src/10.11-source/sql/set_var.cc:207
#9 0x560e45518445 in set_var::update(THD*) /home/anel/mariadb/server/src/10.11-source/sql/set_var.cc:863
#10 0x560e4551781c in sql_set_variables(THD*, List<set_var_base>*, bool) /home/anel/mariadb/server/src/10.11-source/sql/set_var.cc:745
#11 0x560e457ea27f in mysql_execute_command(THD*, bool) /home/anel/mariadb/server/src/10.11-source/sql/sql_parse.cc:5034
#12 0x560e457fe656 in mysql_parse(THD*, char*, unsigned int, Parser_state*) /home/anel/mariadb/server/src/10.11-source/sql/sql_parse.cc:8035
#13 0x560e457d4730 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) /home/anel/mariadb/server/src/10.11-source/sql/sql_parse.cc:1894
#14 0x560e457d14b6 in do_command(THD*, bool) /home/anel/mariadb/server/src/10.11-source/sql/sql_parse.cc:1407
#15 0x560e45c8b137 in do_handle_one_connection(CONNECT*, bool) /home/anel/mariadb/server/src/10.11-source/sql/sql_connect.cc:1418
#16 0x560e45c8a9c3 in handle_one_connection /home/anel/mariadb/server/src/10.11-source/sql/sql_connect.cc:1312
#17 0x560e468bb4b5 in pfs_spawn_thread /home/anel/mariadb/server/src/10.11-source/storage/perfschema/pfs.cc:2201
#18 0x7f6f074b7608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
Attempting backtrace. You can use the following information to find out
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.026 of 5 seconds executing testcases
Warnings in log: All 1 tests were successful.
Errors/warnings were found in logfiles during server shutdown after running the
following sequence(s) of tests:
sys_vars.replicate_rewrite_db
mysql-test-run: *** ERROR: There where errors/warnings in server logs after running test cases.
Basing the PR against the correct MariaDB version
- [x] This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduced
Propose to make the variable name asan_count
, assuming it covers tsan/asan/ubsan/msan etc. issues, to a more generic string like san_count
instead of asan
as it refers to only one tool.
On a sidenote, thank you for making making this patch for MTR. It will be great if all shutdown based *SAN issues are caught for MTR based tests also.
Thanks @mariadb-RoelVandePaar I have updated.