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

Server crashes in handler::ha_external_lock or assertion `m_lock_type == 2' fails in handler::ha_close on disconnect with a locked temporary table

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.36, 10.0.9
    • 5.5.37, 10.0.10
    • None
    • None

    Description

      The problem was introduced by the following revision in 5.5 tree:

      revno: 3683
      revision-id: sergii@pisem.net-20130305164937-9t1pxxoa1kizi0vp
      parent: holyfoot@askmonty.org-20130305214525-2lgv24a11bmeu6iq
      committer: Sergei Golubchik <sergii@pisem.net>
      branch nick: 5.5
      timestamp: Tue 2013-03-05 17:49:37 +0100
      message:
        MDEV-4066 semisync_master + temporary tables causes memory leaks
        
        close (and auto-drop) temporary tables before
        rolling back the last transaction in the connection.

      Test case:

      --source include/have_innodb.inc
      --connect (con1,localhost,root,,)
      CREATE TEMPORARY TABLE tmp (i INT) ENGINE=InnoDB;
      LOCK TABLES tmp AS p WRITE;
      --disconnect con1

      Crash in 5.5:

      #3  <signal handler called>
      #4  0x00000000007ec92f in handler::ha_external_lock (this=0x5a5a5a5a5a5a5a5a, thd=0x7f08343d9060, lock_type=2) at 5.5/sql/handler.cc:5105
      #5  0x00000000008b841e in unlock_external (thd=0x7f08343d9060, table=0x7f082c0160a8, count=1) at 5.5/sql/lock.cc:673
      #6  0x00000000008b797c in mysql_unlock_tables (thd=0x7f08343d9060, sql_lock=0x7f082c016080, free_lock=true) at 5.5/sql/lock.cc:384
      #7  0x00000000005d1539 in close_thread_tables (thd=0x7f08343d9060) at 5.5/sql/sql_base.cc:1577
      #8  0x00000000005d5249 in Locked_tables_list::unlock_locked_tables (this=0x7f08343dc228, thd=0x7f08343d9060) at 5.5/sql/sql_base.cc:3454
      #9  0x00000000005f7986 in THD::cleanup (this=0x7f08343d9060) at 5.5/sql/sql_class.cc:1401
      #10 0x0000000000585ae0 in thd_cleanup (thd=0x7f08343d9060) at 5.5/sql/mysqld.cc:2449
      #11 0x0000000000585b9c in unlink_thd (thd=0x7f08343d9060) at 5.5/sql/mysqld.cc:2483
      #12 0x0000000000585f7d in one_thread_per_connection_end (thd=0x7f08343d9060, put_in_cache=true) at 5.5/sql/mysqld.cc:2604
      #13 0x000000000072f244 in do_handle_one_connection (thd_arg=0x7f08343d9060) at 5.5/sql/sql_connect.cc:1277
      #14 0x000000000072ec5d in handle_one_connection (arg=0x7f08343d9060) at 5.5/sql/sql_connect.cc:1181
      #15 0x0000000000983d61 in pfs_spawn_thread (arg=0x7f08353dfa20) at 5.5/storage/perfschema/pfs.cc:1015
      #16 0x00007f083bfe7b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #17 0x00007f083ab36a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
      #18 0x0000000000000000 in ?? ()

      Stack trace from:

      revision-id: sergii@pisem.net-20140325214118-4i6aijvh8vhrd073
      date: 2014-03-25 22:41:18 +0100
      build-date: 2014-03-26 14:39:37 +0400
      revno: 4126
      branch-nick: 5.5

      Assertion failure in 10.0:

      10.0/sql/handler.cc:2492: int handler::ha_close(): Assertion `m_lock_type == 2' failed.
      140326 14:36:19 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f2aff96e621 in *__GI___assert_fail (assertion=0xfdd2be "m_lock_type == 2", file=<optimized out>, line=2492, function=0xfe0990 "int handler::ha_close()") at assert.c:81
      #7  0x0000000000861832 in handler::ha_close (this=0x7f2aedc37088) at 10.0/sql/handler.cc:2492
      #8  0x000000000074d93d in closefrm (table=0x7f2aedc89070, free_share=false) at 10.0/sql/table.cc:2941
      #9  0x00000000006128b5 in close_temporary (table=0x7f2aedc89070, free_share=true, delete_table=true) at 10.0/sql/sql_base.cc:1705
      #10 0x0000000000611401 in close_temporary_tables (thd=0x7f2af753c070) at 10.0/sql/sql_base.cc:1095
      #11 0x00000000006378d5 in THD::cleanup (this=0x7f2af753c070) at 10.0/sql/sql_class.cc:1524
      #12 0x00000000005b8dbe in thd_cleanup (thd=0x7f2af753c070) at 10.0/sql/mysqld.cc:2659
      #13 0x00000000005b8f58 in unlink_thd (thd=0x7f2af753c070) at 10.0/sql/mysqld.cc:2715
      #14 0x00000000005b939f in one_thread_per_connection_end (thd=0x7f2af753c070, put_in_cache=true) at 10.0/sql/mysqld.cc:2843
      #15 0x000000000078a4ec in do_handle_one_connection (thd_arg=0x7f2af753c070) at 10.0/sql/sql_connect.cc:1390
      #16 0x000000000078a199 in handle_one_connection (arg=0x7f2af753c070) at 10.0/sql/sql_connect.cc:1293
      #17 0x0000000000a2fbac in pfs_spawn_thread (arg=0x7f2af77fd030) at 10.0/storage/perfschema/pfs.cc:1853
      #18 0x00007f2b01512b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #19 0x00007f2affa1da7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Stack trace from:

      revision-id: knielsen@knielsen-hq.org-20140324102216-bm4tclml30c7gvc4
      date: 2014-03-24 11:22:16 +0100
      build-date: 2014-03-26 14:39:12 +0400
      revno: 4081
      branch-nick: 10.0

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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