diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-08 18:20:08 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-08 18:20:08 -0300 |
commit | f56dd32bf7c5b8a8cf35984f39f1a253b75945ff (patch) | |
tree | 6c88c3c07b30acb464ca8bf81bbef916216da616 /mysql-test | |
parent | d3b01fef18b20f3ac589f2ecc95d64326570583f (diff) | |
download | mariadb-git-f56dd32bf7c5b8a8cf35984f39f1a253b75945ff.tar.gz |
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/include/mysqld--help.inc | 2 | ||||
-rw-r--r-- | mysql-test/lib/v1/mtr_report.pl | 14 | ||||
-rwxr-xr-x | mysql-test/lib/v1/mysql-test-run.pl | 4 | ||||
-rwxr-xr-x | mysql-test/mysql-stress-test.pl | 2 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 28 | ||||
-rw-r--r-- | mysql-test/t/bug46080-master.opt | 2 | ||||
-rw-r--r-- | mysql-test/t/mysql-bug45236-master.opt | 1 |
7 files changed, 3 insertions, 50 deletions
diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc index f21f8b20aa4..3c50e50ac0e 100644 --- a/mysql-test/include/mysqld--help.inc +++ b/mysql-test/include/mysqld--help.inc @@ -13,7 +13,7 @@ perl; @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file datadir slave-load-tmpdir tmpdir/; - @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster safemalloc debug temp-pool ssl des-key-file + @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file thread-concurrency super-large-pages mutex-deadlock-detector null-audit/; @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /; $re1=join('|', @skipvars, @plugins); diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 36aba983c34..84784ed19d4 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -253,19 +253,8 @@ sub mtr_report_stats ($) { mtr_warning("can't read $errlog"); next; } - my $leak_reports_expected= undef; while ( <ERR> ) { - # There is a test case that purposely provokes a - # SAFEMALLOC leak report, even though there is no actual - # leak. We need to detect this, and ignore the warning in - # that case. - if (/Begin safemalloc memory dump:/) { - $leak_reports_expected= 1; - } elsif (/End safemalloc memory dump./) { - $leak_reports_expected= undef; - } - # Skip some non fatal warnings from the log files if ( /\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or @@ -426,9 +415,6 @@ sub mtr_report_stats ($) { } if ( /$pattern/ ) { - if ($leak_reports_expected) { - next; - } $found_problems= 1; print WARN basename($errlog) . ": $testname: $_"; } diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 64d7376605e..8a5edfbd762 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -3882,8 +3882,6 @@ sub mysqld_arguments ($$$$) { if ( $opt_valgrind_mysqld ) { - mtr_add_arg($args, "%s--loose-skip-safemalloc", $prefix); - if ( $mysql_version_id < 50100 ) { mtr_add_arg($args, "%s--skip-bdb", $prefix); @@ -4722,7 +4720,6 @@ sub run_check_testcase ($$) { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); @@ -4805,7 +4802,6 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--logdir=%s/log", $opt_vardir); diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl index e51eba04525..504bee1ebbc 100755 --- a/mysql-test/mysql-stress-test.pl +++ b/mysql-test/mysql-stress-test.pl @@ -123,7 +123,7 @@ $pid_file="mysql_stress_test.pid"; $opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest"; $opt_check_tests_file=""; # OBM adding a setting for 'max-connect-retries=20' the default of 500 is to high -@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=20"); +@mysqltest_args=("--silent", "-v", "--max-connect-retries=20"); # Client ip address $client_ip=inet_ntoa((gethostbyname(hostname()))[4]); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c5cc3c5c295..1a574fe6e6b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3180,7 +3180,6 @@ sub start_run_one ($$) { mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--test-file=%s", "include/$run.test"); my $errfile= "$opt_vardir/tmp/$name.err"; @@ -3759,25 +3758,6 @@ sub extract_server_log ($$) { } $Ferr = undef; # Close error log file - # mysql_client_test.test sends a COM_DEBUG packet to the server - # to provoke a SAFEMALLOC leak report, ignore any warnings - # between "Begin/end safemalloc memory dump" - if ( grep(/Begin safemalloc memory dump:/, @lines) > 0) - { - my $discard_lines= 1; - foreach my $line ( @lines ) - { - if ($line =~ /Begin safemalloc memory dump:/){ - $discard_lines = 1; - } elsif ($line =~ /End safemalloc memory dump./){ - $discard_lines = 0; - } - - if ($discard_lines){ - $line = "ignored"; - } - } - } return @lines; } @@ -3873,8 +3853,6 @@ sub start_check_warnings ($$) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - - mtr_add_arg($args, "--loose-skip-safemalloc"); mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); if ( $opt_embedded_server ) @@ -4305,8 +4283,6 @@ sub mysqld_arguments ($$$) { if ( $opt_valgrind_mysqld ) { - mtr_add_arg($args, "--loose-skip-safemalloc"); - if ( $mysql_version_id < 50100 ) { mtr_add_arg($args, "--skip-bdb"); @@ -4899,9 +4875,6 @@ sub start_check_testcase ($$$) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); - - mtr_add_arg($args, "--skip-safemalloc"); - mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test"); mtr_add_arg($args, "--verbose"); @@ -4942,7 +4915,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--defaults-file=%s", $path_config_file); mtr_add_arg($args, "--silent"); - mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir); mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); mtr_add_arg($args, "--logdir=%s/log", $opt_vardir); diff --git a/mysql-test/t/bug46080-master.opt b/mysql-test/t/bug46080-master.opt index 71024d39356..1be97e178ed 100644 --- a/mysql-test/t/bug46080-master.opt +++ b/mysql-test/t/bug46080-master.opt @@ -1 +1 @@ ---loose-performance-schema=0 --skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000 +--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve diff --git a/mysql-test/t/mysql-bug45236-master.opt b/mysql-test/t/mysql-bug45236-master.opt deleted file mode 100644 index fc1887bca47..00000000000 --- a/mysql-test/t/mysql-bug45236-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-skip-safemalloc |