Bug #72217 When uninstall a audit plugin, there is a warning info which is not correct
Submitted: 3 Apr 2014 9:33 Modified: 3 Apr 2014 11:17
Reporter: Hao Liu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.5, 5.6 OS:Any
Assigned to: CPU Architecture:Any

[3 Apr 2014 9:33] Hao Liu
Description:
When uninstall a plugin which is audit type, there is a warning information "Plugin is busy and will be uninstalled on shutdown"  which is confusing.

The first half of the sentence is correct, because of the plugin->ref_count is not zero. But the second half is not correct, the plugin will be uninstalled (reap_plugin function is called) after all the existing commands are finished (actually only these threads which have called mysql_audit_general are affected), not on shutdown. 

In general, you can install plugin again immediately, the plugin has been deinited cleanly.

How to repeat:
root@(none) 05:31:44>install plugin NULL_AUDIT soname 'adt_null.so';
Query OK, 0 rows affected (1.41 sec)

root@(none) 05:31:50>uninstall plugin NULL_AUDIT;
Query OK, 0 rows affected, 1 warning (1.84 sec)

root@(none) 05:31:57>show warnings;
+---------+------+----------------------------------------------------+
| Level   | Code | Message                                            |
+---------+------+----------------------------------------------------+
| Warning | 1620 | Plugin is busy and will be uninstalled on shutdown |
+---------+------+----------------------------------------------------+
1 row in set (0.00 sec)

root@(none) 05:32:02>install plugin NULL_AUDIT soname 'adt_null.so';
Query OK, 0 rows affected (0.01 sec)

Suggested fix:
modify the warning info, it is confusing.
[3 Apr 2014 11:17] MySQL Verification Team
Thank you for the bug report. Verified as described.
[7 Apr 2014 8:51] Mattias Jonsson
When fixing the error message for this, also please look into other plugin-related error messages like:
- Installing an already installed plugin returns ER_UDF_EXISTS, but there are other plugins than UDF's (error message is "Function '<plugin name>' already exists", better to use "PLUGIN '<plugin name>' already exists").
- Uninstalling a non-existing plugin returns ER_SP_DOES_NOT_EXISTS (error message is OK: 'PLUGIN <plugin-name> does not exist'.)
[26 Dec 2017 11:39] Daniƫl van Eeden
Also affects 5.7.18
[5 Sep 2023 16:16] Simon Mudd
I'll add that affects 8.0.34 and I guess 8.1.0 too.