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

Spider uninstall fails with "plugin busy"

Details

    Description

      10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd

      install soname 'ha_spider';
      create table t (c int) Engine=SPIDER;
      drop table t;
      uninstall soname 'ha_spider';
      

      The uninstall statement results in warning:

      Warnings:
      Warning	1620	Plugin is busy and will be uninstalled on shutdown
      

      Initial analysis shows this could be caused by a call to thd_set_ha_data(thd, spider_hton_ptr, trx) which increases the ref count to the plugin which later did not get decreased, from spider_get_trx() during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

      [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

      Trace:

      intern_plugin_lock > plugin_lock > ha_lock_engine > thd_set_ha_data > ha_spider::create > handler::ha_create > create_table_impl > mysql_create_table_no_lock > Sql_cmd_create_table_like::execute > mysql_parse > dispatch_command > do_command > handle_one_connection > pfs_spawn_thread

      Attachments

        Issue Links

          Activity

            ycp Yuchen Pei created issue -
            ycp Yuchen Pei made changes -
            Field Original Value New Value
            Component/s Storage Engine - Spider [ 10132 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            Description {code:sql|10.10 }
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to{{thd_set_ha_data(thd, spider_hton_ptr, trx);}} from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            {code:sql|title=10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd}
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to{{thd_set_ha_data(thd, spider_hton_ptr, trx);}} from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            ycp Yuchen Pei made changes -
            Description {code:sql|title=10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd}
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to{{thd_set_ha_data(thd, spider_hton_ptr, trx);}} from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            {code:sql|title=10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd}
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to {{thd_set_ha_data(thd, spider_hton_ptr, trx);}} from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            ycp Yuchen Pei made changes -
            Description {code:sql|title=10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd}
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to {{thd_set_ha_data(thd, spider_hton_ptr, trx);}} from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            {code:sql|title=10.10 21822625aa675b36a5c2548f78e8d3d8cde8b7cd}
            install soname 'ha_spider';
            create table t (c int) Engine=SPIDER;
            drop table t;
            uninstall soname 'ha_spider';
            {code}

            The {{uninstall}} statement results in warning:
            {noformat}
            Warnings:
            Warning 1620 Plugin is busy and will be uninstalled on shutdown
            {noformat}

            Initial analysis shows this could be caused by a call to {{thd_set_ha_data(thd, spider_hton_ptr, trx)}} which increases the ref count to the plugin which later did not get decreased, from {{spider_get_trx()}} during the create table statement. See also kentoku's comment in MDEV-7914[1], whose commit is to blame for this call.

            [1] https://jira.mariadb.org/browse/MDEV-7914?focusedCommentId=109258&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-109258

            Trace:

            [intern_plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1001] > [plugin_lock|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_plugin.cc#L1052] > [ha_lock_engine|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L332] > [thd_set_ha_data|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_class.cc#L473] > [ha_spider::create|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/storage/spider/ha_spider.cc#L8487] > [handler::ha_create|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/handler.cc#L5517] > [create_table_impl|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4614] > [mysql_create_table_no_lock|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L4715] > [Sql_cmd_create_table_like::execute|https://github.com/MariaDB/server/blob/4300313b803f277b986ec8f080b516b6ad654bc4/sql/sql_table.cc#L12568] > [mysql_parse|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L8054] > [dispatch_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1894] > [do_command|https://github.com/MariaDB/server/blob/014167880d2af3cb49413303a2cc1074552f75c9/sql/sql_parse.cc#L1407] > [handle_one_connection|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/sql/sql_connect.cc#L1318] > [pfs_spawn_thread|https://github.com/MariaDB/server/blob/21822625aa675b36a5c2548f78e8d3d8cde8b7cd/storage/perfschema/pfs.cc#L2201]
            serg Sergei Golubchik made changes -
            Affects Version/s 10.10 [ 27530 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.11 [ 27614 ]
            ycp Yuchen Pei made changes -
            Affects Version/s 10.4 [ 22408 ]
            ycp Yuchen Pei added a comment -

            Could reproduce at 10.4 87a5d16911bb94d383480fdd49e20876ed1400f2

            ycp Yuchen Pei added a comment - Could reproduce at 10.4 87a5d16911bb94d383480fdd49e20876ed1400f2
            ycp Yuchen Pei added a comment -

            Normally one could counter the call to thd_set_ha_data() with a
            call to thd_set_ha_data() with ha_data=NULL. However this is
            commonly done when closing a connection, which happens after all
            statements have been executed. See also the documentation of
            Ha_data::ha_ptr which notes lifetime of one user connection.

            If we simply remove the call to thd_set_ha_data() in
            spider_get_trx(), or add a call to thd_set_ha_data() with
            NULL at the end of ha_spider::create(), then we get memory
            leaks.

            InnoDB for example, like Spider, may increment the ref_count during a
            statement with the same call, and only calls thd_set_ha_data() on
            NULL at close_connection. Though one could not uninstall InnoDB which
            is an internal plugin so the problem is sidestepped.

            ycp Yuchen Pei added a comment - Normally one could counter the call to thd_set_ha_data() with a call to thd_set_ha_data() with ha_data=NULL . However this is commonly done when closing a connection, which happens after all statements have been executed. See also the documentation of Ha_data::ha_ptr which notes lifetime of one user connection. If we simply remove the call to thd_set_ha_data() in spider_get_trx() , or add a call to thd_set_ha_data() with NULL at the end of ha_spider::create() , then we get memory leaks. InnoDB for example, like Spider, may increment the ref_count during a statement with the same call, and only calls thd_set_ha_data() on NULL at close_connection. Though one could not uninstall InnoDB which is an internal plugin so the problem is sidestepped.
            serg Sergei Golubchik made changes -
            Fix Version/s 10.4 [ 22408 ]
            ycp Yuchen Pei made changes -
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.4 [ 22408 ]

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.