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

Assertion failures in handler::ha_external_lock or handler::ha_close upon locking sequence

    XMLWordPrintable

Details

    Description

      CREATE SEQUENCE s ENGINE=MyISAM;
      CREATE TABLE t (f INT DEFAULT(NEXTVAL(s))) ENGINE=MyISAM;
      LOCK TABLE s READ;
       
      --connect (con1,localhost,root,,)
      SET lock_wait_timeout= 1;
      --error ER_LOCK_WAIT_TIMEOUT
      ALTER TABLE t FORCE;
      --error ER_LOCK_WAIT_TIMEOUT
      CREATE INDEX idx ON t(f);
       
      # Cleanup
      --connection default
      UNLOCK TABLES;
      DROP TABLE t;
      DROP SEQUENCE s;
      --disconnect con1
      

      10.4 64f44b22d9a3dab3d4c0b77addbcbdafde57b466

      mysqld: /data/bld/10.4-asan/sql/handler.cc:6531: int handler::ha_external_lock(THD*, int): Assertion `table_share->tmp_table != NO_TMP_TABLE || ((lock_type != 2 && m_lock_type == 2) || lock_type == 2)' failed.
      231125 21:31:30 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fe336253e32 in __GI___assert_fail (assertion=0x556d00cd3e40 "table_share->tmp_table != NO_TMP_TABLE || ((lock_type != 2 && m_lock_type == 2) || lock_type == 2)", file=0x556d00cccac0 "/data/bld/10.4-asan/sql/handler.cc", line=6531, function=0x556d00cd3d40 "int handler::ha_external_lock(THD*, int)") at ./assert/assert.c:101
      #10 0x0000556cff0a82cd in handler::ha_external_lock (this=0x61c0000208a8, thd=0x62b00008c208, lock_type=0) at /data/bld/10.4-asan/sql/handler.cc:6531
      #11 0x0000556cff39c492 in lock_external (thd=0x62b00008c208, tables=0x60600001c858, count=1) at /data/bld/10.4-asan/sql/lock.cc:396
      #12 0x0000556cff39bc6d in mysql_lock_tables (thd=0x62b00008c208, sql_lock=0x60600001c828, flags=16384) at /data/bld/10.4-asan/sql/lock.cc:341
      #13 0x0000556cff39b935 in mysql_lock_tables (thd=0x62b00008c208, tables=0x62b000094880, count=1, flags=16384) at /data/bld/10.4-asan/sql/lock.cc:304
      #14 0x0000556cfe74c46c in lock_tables (thd=0x62b00008c208, tables=0x62b000093340, count=1, flags=16384) at /data/bld/10.4-asan/sql/sql_base.cc:5567
      #15 0x0000556cfeb56dc3 in mysql_alter_table (thd=0x62b00008c208, new_db=0x62b000093358, new_name=0x62b000093368, create_info=0x7fe32c606850, table_list=0x62b000093340, recreate_info=0x7fe32c6062e0, alter_info=0x7fe32c606640, order_num=0, order=0x0, ignore=false) at /data/bld/10.4-asan/sql/sql_table.cc:10570
      #16 0x0000556cfe8d123b in mysql_execute_command (thd=0x62b00008c208) at /data/bld/10.4-asan/sql/sql_parse.cc:4256
      #17 0x0000556cfe8eba6b in mysql_parse (thd=0x62b00008c208, rawbuf=0x62b000093228 "CREATE INDEX idx ON t(f)", length=24, parser_state=0x7fe32c607c60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8060
      #18 0x0000556cfe8c1ae2 in dispatch_command (command=COM_QUERY, thd=0x62b00008c208, packet=0x62900023f209 "CREATE INDEX idx ON t(f)", packet_length=24, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
      #19 0x0000556cfe8be651 in do_command (thd=0x62b00008c208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
      #20 0x0000556cfecc4d15 in do_handle_one_connection (connect=0x608000000aa8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
      #21 0x0000556cfecc462c in handle_one_connection (arg=0x608000000aa8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
      #22 0x0000556cff92926c in pfs_spawn_thread (arg=0x615000003c88) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
      #23 0x00007fe3362a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #24 0x00007fe33632861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The same test case without CREATE INDEX also fails, in a different way (later on DROP TABLE):

      CREATE SEQUENCE s ENGINE=MyISAM;
      CREATE TABLE t (f INT DEFAULT(NEXTVAL(s))) ENGINE=MyISAM;
      LOCK TABLE s READ;
       
      --connect (con1,localhost,root,,)
      SET lock_wait_timeout= 1;
      --error ER_LOCK_WAIT_TIMEOUT
      ALTER TABLE t FORCE;
       
      # Cleanup
      --connection default
      UNLOCK TABLES;
      DROP TABLE t;
      DROP SEQUENCE s;
      --disconnect con1
      

      mysqld: /data/bld/10.4-asan/sql/handler.cc:2888: int handler::ha_close(): Assertion `m_lock_type == 2' failed.
      231125 21:32:35 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f63cf053e32 in __GI___assert_fail (assertion=0x55b4acfb5e80 "m_lock_type == 2", file=0x55b4acfb2ac0 "/data/bld/10.4-asan/sql/handler.cc", line=2888, function=0x55b4acfb61c0 "int handler::ha_close()") at ./assert/assert.c:101
      #10 0x000055b4ab3709b0 in handler::ha_close (this=0x61c0000208a8) at /data/bld/10.4-asan/sql/handler.cc:2888
      #11 0x000055b4aaedbbc1 in closefrm (table=0x620000050088) at /data/bld/10.4-asan/sql/table.cc:4241
      #12 0x000055b4ab1a2f5e in intern_close_table (table=0x620000050088) at /data/bld/10.4-asan/sql/table_cache.cc:221
      #13 0x000055b4ab1aa5fb in tdc_remove_table (thd=0x62b00005b208, remove_type=TDC_RT_REMOVE_ALL, db=0x62b0000629f8 "test", table_name=0x62b0000622b0 "t", kill_delayed_threads=false) at /data/bld/10.4-asan/sql/table_cache.cc:1152
      #14 0x000055b4aae0228d in mysql_rm_table_no_locks (thd=0x62b00005b208, tables=0x62b000062300, if_exists=false, drop_temporary=false, drop_view=false, drop_sequence=false, dont_log_query=false, dont_free_locks=false) at /data/bld/10.4-asan/sql/sql_table.cc:2536
      #15 0x000055b4aae0011b in mysql_rm_table (thd=0x62b00005b208, tables=0x62b000062300, if_exists=false, drop_temporary=false, drop_sequence=false) at /data/bld/10.4-asan/sql/sql_table.cc:2152
      #16 0x000055b4aabbcd69 in mysql_execute_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:4961
      #17 0x000055b4aabd1a6b in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "DROP TABLE t", length=12, parser_state=0x7f63c6029c60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8060
      #18 0x000055b4aaba7ae2 in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x62900021c209 "DROP TABLE t", packet_length=12, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
      #19 0x000055b4aaba4651 in do_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
      #20 0x000055b4aafaad15 in do_handle_one_connection (connect=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
      #21 0x000055b4aafaa62c in handle_one_connection (arg=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
      #22 0x000055b4abc0f26c in pfs_spawn_thread (arg=0x615000003508) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
      #23 0x00007f63cf0a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #24 0x00007f63cf12861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      On a non-debug build both variations end up with a memory leak complaint:

      Warning: Memory not freed: 64
      

      Reproducible with MyISAM and Aria.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.