Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-21014: MTR does not detect [A,M,T,L,UB]SAN errors which happen upon server shutdown #2251

Open
wants to merge 1 commit into
base: 11.0
Choose a base branch
from

Conversation

an3l
Copy link
Collaborator

@an3l an3l commented Sep 1, 2022

  • 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 42bad56

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

  • This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduced

@an3l an3l requested a review from vuvova September 1, 2022 06:30
@an3l an3l self-assigned this Sep 1, 2022
@an3l an3l added the MariaDB Foundation Pull requests created by MariaDB Foundation label Sep 1, 2022
@an3l an3l added this to the 10.3 milestone Sep 1, 2022
@mariadb-RoelVandePaar
Copy link

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.

@an3l an3l force-pushed the bb-10.3-anel-MDEV-21014-asan branch from 58f2975 to f38dec3 Compare October 2, 2022 05:29
@an3l
Copy link
Collaborator Author

an3l commented Oct 2, 2022

Thanks @mariadb-RoelVandePaar I have updated.

@an3l an3l force-pushed the bb-10.3-anel-MDEV-21014-asan branch from f38dec3 to 7f2a28d Compare October 20, 2022 12:22
@an3l an3l removed their assignment Mar 28, 2023
…pon server shutdown

- Patch is allowing to show more traces to mtr stdout from sanitizer
- Patch doesn't output shadow bytes from sanitzer
- Update to patch 42bad56

Reviewer: <>
@an3l an3l force-pushed the bb-10.3-anel-MDEV-21014-asan branch from 7f2a28d to d4b1b21 Compare March 12, 2024 11:47
@an3l an3l changed the base branch from 10.3 to 11.0 March 12, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MariaDB Foundation Pull requests created by MariaDB Foundation
2 participants