[MDEV-11987] False "Plugin is busy and will be uninstalled on shutdown" message Created: 2017-02-03  Updated: 2017-02-06  Resolved: 2017-02-06

Status: Closed
Project: MariaDB Server
Component/s: Plugins
Affects Version/s: 10.1.19
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Unassigned
Resolution: Not a Bug Votes: 1
Labels: None
Environment:

linux



 Description   

A storage engine can easily be uninstalled as long as no open table is currently relying on that plugin.

E.g. lets create a BLACKHOLE table, then uninstall the plugin right away while the table still exists. This works fine:

MariaDB [test]> install soname "ha_blackhole";
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> create table t1 (id int primary key) engine=BLACKHOLE;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [test]> uninstall plugin blackhole;
Query OK, 0 rows affected (0.00 sec)

Doing a FLUSH TABLES after using the table and before uninstalling the plugin also works (but obviously there is potential for a race condition now):

MariaDB [test]> install soname "ha_blackhole";
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> select * from t1;
Empty set (0.01 sec)
 
MariaDB [test]> flush tables;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> uninstall plugin blackhole;
Query OK, 0 rows affected (0.00 sec)

Now lets try without FLUSH TABLES:

MariaDB [test]> install soname "ha_blackhole";
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> select * from t1;
Empty set (0.00 sec)
 
MariaDB [test]> uninstall plugin blackhole;
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
MariaDB [test]> show warnings;
+---------+------+----------------------------------------------------+
| Level   | Code | Message                                            |
+---------+------+----------------------------------------------------+
| Warning | 1620 | Plugin is busy and will be uninstalled on shutdown |
+---------+------+----------------------------------------------------+
1 row in set (0.00 sec)
 
MariaDB [test]> show plugins;
+-------------------------------+----------+--------------------+-----------------+---------+
| Name                          | Status   | Type               | Library         | License |
+-------------------------------+----------+--------------------+-----------------+---------+
[...]
| BLACKHOLE                     | DELETED  | STORAGE ENGINE     | ha_blackhole.so | GPL     |
+-------------------------------+----------+--------------------+-----------------+---------+
56 rows in set (0.00 sec)

Fair enough. But maybe we can flush, then try UNINSTALL once more? Unfortunately not really:

MariaDB [test]> flush tables;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> uninstall plugin blackhole;
ERROR 1305 (42000): PLUGIN blackhole does not exist

Funny enough though: SHOW PLUGINS no longer shows an entry for BLACKHOLE anymore though.

Now for the real problem though: I stopped the mysqld server process with mysqladmin shutdown and restarted it, and found the plugin to be alive and kicking again:

MariaDB [test]> show status like "uptime"; -- verify that it *really* got restarted
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime        | 5   |
+---------------+-------+
1 row in set (0.00 sec)
 
MariaDB [test]> show plugins;
+-------------------------------+----------+--------------------+-----------------+---------+
| Name                          | Status   | Type               | Library         | License |
+-------------------------------+----------+--------------------+-----------------+---------+
[...]
| BLACKHOLE                     | ACTIVE   | STORAGE ENGINE     | ha_blackhole.so | GPL     |
+-------------------------------+----------+--------------------+-----------------+---------+
56 rows in set (0.00 sec)

So "Plugin is busy and will be uninstalled on shutdown" turns out to be not true.

This is independent of the extra FLUSH/UNINSTALL step after seeing the warning, it happens to come back from the dead in both cases.

Only safe way to get rid of the plugin is to FLUSH TABLES to close all tables using it before trying to uninstall. Unfortunately there's the possibility that another connection uses the table again between FLUSH and UNINSTALL ...



 Comments   
Comment by Elena Stepanova [ 2017-02-03 ]

hholzgra, so, what's the bug? That it can be uninstalled? The summary seems to complain about the warning, but there is no warning in your scenario.
Or do you suggest to change the wording of the warnings, so it says that the user needs to flush tables to get the plugin uninstalled?

Comment by Hartmut Holzgraefe [ 2017-02-03 ]

The main bug is that it is still there after restart even though the warning said it would be removed on shutdown

Comment by Hartmut Holzgraefe [ 2017-02-03 ]

Also the "flush before uninstall" approach has a race condition. I tried to get around that with LOCK TABLES, but that again opens the tables ... next test: see if FLUSH works after having the LOCK

(you may have seen an unfinished version of the text as I accidentially submitted while only having written half the text)

Comment by Hartmut Holzgraefe [ 2017-02-03 ]

Can't flush while holding locks:

MariaDB [test]> lock tables test.t1 read, mysql.plugin write;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> flush tables;
ERROR 1099 (HY000): Table 't1' was locked with a READ lock and can't be updated
 
MariaDB [test]> uninstall plugin blackhole;
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
MariaDB [test]> show warnings;
+---------+------+----------------------------------------------------+
| Level   | Code | Message                                            |
+---------+------+----------------------------------------------------+
| Warning | 1620 | Plugin is busy and will be uninstalled on shutdown |
+---------+------+----------------------------------------------------+
1 row in set (0.00 sec)

Comment by Hartmut Holzgraefe [ 2017-02-03 ]

No luck with FTWRL either:

MariaDB [test]> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> uninstall plugin blackhole;
ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock

Comment by Elena Stepanova [ 2017-02-03 ]

>> Funny enough though: SHOW PLUGINS no longer shows an entry for BLACKHOLE anymore though.

It looks correct. The warning does not tell the whole story – it's not really about not being able to uninstall before shutdown, the plugin is "busy" because you have open tables. When you flush the tables, plugin is no longer busy and thus gets uninstalled.

>> Now for the real problem though: I stopped the mysqld server process with mysqladmin shutdown and restarted it, and found the plugin to be alive and kicking again:

I can't reproduce this part. Are you sure you don't have plugin-load=ha_blackhole somewhere in config? install soname 'ha_blackhole' wouldn't complain about it, so it doesn't contradict anything that we can see above, and would explain why the plugin is there after restart.

Comment by Hartmut Holzgraefe [ 2017-02-03 ]

> Are you sure you don't have plugin-load=ha_blackhole somewhere in config? install soname 'ha_blackhole' wouldn't complain about it, so it doesn't contradict anything that we can see above, and would explain why the plugin is there after restart.

Indeed, had that as leftover from previous tests ...

Ok to close as "not a bug"

Generated at Thu Feb 08 07:54:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.