Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.2.3
-
None
-
None
Description
When multiple threads in the same application attempt to connect to a server using a client-side authentication plugin, the following error can be observed from time to time.
1045: Plugin client_ed25519 could not be loaded: it is already loaded
|
Looking at the code in ma_client_plugin.c.in:
/* make sure the plugin wasn't loaded meanwhile */ |
if (find_plugin(plugin->name, plugin->type)) |
{
|
my_set_error(mysql, CR_AUTH_PLUGIN_CANNOT_LOAD,
|
SQLSTATE_UNKNOWN, ER(CR_AUTH_PLUGIN_CANNOT_LOAD),
|
plugin->name, "it is already loaded"); |
plugin= NULL;
|
}
|
we see that something that can only occur with more than one thread is treated as an error. Additionally, it seems that the initial find_plugin() call is not done under the same lock under which the plugin loading is done. This would explain why more than one thread attempts to load the same plugin.
I believe that either the whole mysql_client_find_plugin should be covered by the same mutex or the already existing plugin should be returned instead of treating it as an error.