Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4161

Assertion `status_var.memory_used == 0' fails in virtual THD::~THD()

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.1
    • Fix Version/s: 10.0.2, 5.5.31
    • Component/s: None
    • Labels:
      None

      Description

      mysqld: 10.0/sql/sql_class.cc:1572: virtual THD::~THD(): Assertion `status_var.memory_used == 0' failed.
      [ERROR] mysqld got signal 6 ;

      #5  0x00007f2143c34b8b in __GI_abort () at abort.c:91
      #6  0x00007f2143c2a0ee in __assert_fail_base (fmt=<optimized out>, assertion=0xd90a88 "status_var.memory_used == 0", file=0xd907c8 "10.0/sql/sql_class.cc", line=<optimized out>, function=<optimized out>) at assert.c:94
      #7  0x00007f2143c2a192 in __GI___assert_fail (assertion=0xd90a88 "status_var.memory_used == 0", file=0xd907c8 "10.0/sql/sql_class.cc", line=1572, function=0xd92790 "virtual THD::~THD()") at assert.c:103
      #8  0x00000000005d9502 in THD::~THD (this=0x48e3f90, __in_chrg=<optimized out>) at 10.0/sql/sql_class.cc:1572
      #9  0x00000000005d9664 in THD::~THD (this=0x48e3f90, __in_chrg=<optimized out>) at 10.0/sql/sql_class.cc:1577
      #10 0x0000000000562120 in unlink_thd (thd=0x48e3f90) at 10.0/sql/mysqld.cc:2599
      #11 0x0000000000562412 in one_thread_per_connection_end (thd=0x48e3f90, put_in_cache=true) at 10.0/sql/mysqld.cc:2701
      #12 0x000000000071f46d in do_handle_one_connection (thd_arg=0x48e3f90) at 10.0/sql/sql_connect.cc:1278
      #13 0x000000000071ed97 in handle_one_connection (arg=0x48e3f90) at 10.0/sql/sql_connect.cc:1181
      #14 0x00007f21449fae9a in start_thread (arg=0x7f2144f45700) at pthread_create.c:308

      revision-id: sanja@askmonty.org-20130204153039-ws7tcwfmbi6vil6e
      revno: 3501
      branch-nick: 10.0

      Perl test (adjust port and duration as needed, default values are 3306 and 300 seconds):

      use DBI;
      use Time::HiRes;
      use Getopt::Long;
      use strict;
       
      my $port=3306;
      my $duration=300;
       
      GetOptions (
         "port=i" => \$port,
         "duration=i" => \$duration
      );
       
      my $dsn="DBI:mysql:test;host=127.0.0.1;port=$port";
      my $victim;
      my $test_end = time() + $duration;
       
      my $dbh = DBI->connect($dsn,'root','') || die "Could not connect: $DBI::errstr";
      $dbh->do('DROP TABLE IF EXISTS A');
      $dbh->do('CREATE TABLE A (col_int_nokey INT, col_int_key INT, KEY (col_int_key)) ENGINE=InnoDB');
       
      foreach (1..10)
      {
         my $pid = fork();
         unless ( defined $pid ) {
            die "Could not fork: $!\n";
         }
         if ( $pid == 0 ) {
            run_worker();
            exit;
         }
      }
       
      while ($dbh->ping && ( time() <= $test_end+1 )) 
      {
         $victim = $dbh->selectcol_arrayref("SELECT `id` FROM INFORMATION_SCHEMA.PROCESSLIST WHERE id > CONNECTION_ID() ORDER BY RAND() LIMIT 1");
         if ( ! $DBI::err && $victim && @$victim ) {
            $dbh->do("KILL ". $victim->[0]);
            Time::HiRes::sleep (0.1);
         }
      }
      print "All good\n" unless $DBI::errstr;
       
      sub run_worker 
      {
         my $dbh;
        WORK:
         while ( $dbh = DBI->connect($dsn,'root','',{ PrintError=>0 }) ) 
         {
            while ( $dbh->do('SELECT * FROM A WHERE col_int_key < ' . int(rand(100))) ) { last WORK if time() >= $test_end } ;
         }
         $dbh->disconnect() if $dbh;
      }
       

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: