[CONC-568] Race condition in loading of client plugins Created: 2021-10-05 Updated: 2021-10-08 Resolved: 2021-10-08 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | None |
| Affects Version/s: | 3.2.3 |
| Fix Version/s: | 3.3.0, 3.2.5, 3.1.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | markus makela | Assignee: | Georg Richter |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | 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.
Looking at the code in ma_client_plugin.c.in:
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. |
| Comments |
| Comment by Georg Richter [ 2021-10-08 ] |
|
Please note that the commit message is partially incorrect. It doesn't affect mysql_load_plugins_v() api function, but mysql_client_register_plugin() api function |