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

RQG induced crash in mi_assign_to_key_cache in safe mutex unlock

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.12, 5.5.34, 10.0.6
    • Fix Version/s: 5.5.35, 10.0.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      centos 6.2 running a debug build of mariadb-5.5.34

      Description

      When running this RQG test:

      ./runall.pl --grammar=conf/partitioning/partitions-99-hash.yy --duration=300 --queries=100000000 --threads=64 --basedir=/home/prohaska/mariadb-5.5.34-install/ --vardir=/home/prohaska/vardir.part99.3 --mask-level=0 --mask=0 --seed=1 --mysqld=--general_log --sqltrace

      The code hits an assert in safe_mutex_unlock. With this code in mi_keycache.c that i added:

        lock = &share->key_cache->op_lock;
        pthread_mutex_lock(&share->key_cache->op_lock);
        if (flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
                             FLUSH_RELEASE))
        { 
          error= my_errno;
          mi_print_error(info->s, HA_ERR_CRASHED);
          mi_mark_crashed(info);              /* Mark that table must be checked */
        }
      =>assert(lock == &share->key_cache->op_lock);
        pthread_mutex_unlock(&share->key_cache->op_lock);

      Hits the assert since some other thread probably changed the share->key_cache pointer:

      #8  0x0000000000c3988a in mi_assign_to_key_cache (info=0x7fb600b1ba60, key_map=1, key_cache=0x7fb60c83ebe0) at /home/prohaska/mariadb-5.5.34/storage/myisam/mi_keycache.c:89
      #9  0x0000000000c147ff in ha_myisam::assign_to_keycache (this=0x7fb6005d3e78, thd=0x7fb5f194c060, check_opt=0x7fb5efb22ce0) at /home/prohaska/mariadb-5.5.34/storage/myisam/ha_myisam.cc:1237
      #10 0x0000000000c752a5 in ha_partition::handle_opt_part (this=0x7fb5f66ffa78, thd=0x7fb5f194c060, check_opt=0x7fb5efb22ce0, part_id=5, flag=5) at /home/prohaska/mariadb-5.5.34/sql/ha_partition.cc:1084
      #11 0x0000000000c75978 in ha_partition::handle_opt_partitions (this=0x7fb5f66ffa78, thd=0x7fb5f194c060, check_opt=0x7fb5efb22ce0, flag=5) at /home/prohaska/mariadb-5.5.34/sql/ha_partition.cc:1239
      #12 0x0000000000c75083 in ha_partition::assign_to_keycache (this=0x7fb5f66ffa78, thd=0x7fb5f194c060, check_opt=0x7fb5efb22ce0) at /home/prohaska/mariadb-5.5.34/sql/ha_partition.cc:1011
      #13 0x00000000007159c0 in mysql_admin_table(THD *, TABLE_LIST *, HA_CHECK_OPT *, const char *, thr_lock_type, bool, bool, uint, int (*)(THD *, TABLE_LIST *, HA_CHECK_OPT *), struct {...}, int (*)(THD *, \
      TABLE_LIST *)) (thd=0x7fb5f194c060, tables=0x7fb5f11da168, check_opt=0x7fb5efb22ce0, operator_name=0xd7efcd "assign_to_keycache", lock_type=TL_READ_NO_INSERT, open_for_modify=false, repair_table_use_frm=\
      false, extra_open_options=0, prepare_func=0x0, operator_func=&virtual table offset 504, view_operator_func=0x0) at /home/prohaska/mariadb-5.5.34/sql/sql_admin.cc:649
      #14 0x0000000000716c27 in mysql_assign_to_keycache (thd=0x7fb5f194c060, tables=0x7fb5f11da168, key_cache_name=0x7fb5f194fe48) at /home/prohaska/mariadb-5.5.34/sql/sql_admin.cc:992
      #15 0x000000000060a1dc in mysql_execute_command (thd=0x7fb5f194c060) at /home/prohaska/mariadb-5.5.34/sql/sql_parse.cc:2349
      #16 0x00000000006132be in mysql_parse (thd=0x7fb5f194c060, rawbuf=0x7fb5f11da078 "CACHE INDEX i IN c4", length=19, parser_state=0x7fb5efb23650) at /home/prohaska/mariadb-5.5.34/sql/sql_parse.cc:5798
       
      (gdb) p lock
      $1 = (void *) 0x7fb622c1e6b0
      (gdb) p &share->key_cache->op_lock
      $2 = (safe_mutex_t *) 0x7fb5ff8308b0

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              prohaska7 Rich Prohaska
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: