← Back to team overview

maria-developers team mailing list archive

MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES and INSTALL PLUGIN

 

Hi Sergei,

I'm afraid I couldn't find easy fix for this deadlock. The question is if it
is worth to spend time for more complex (and possibly less stable) solution.
Details below.

Locking profile
---------------
INSTALL PLUGIN: LOCK_plugin                    -> LOCK_system_variables_hash (w)
SHOW VARIABLES: LOCK_system_variables_hash (r) -> LOCK_global_system_variables
 change_user(): LOCK_global_system_variables   -> LOCK_plugin

INSTALL PLUGIN
--------------
Needs LOCK_plugin to register new plugin.
Needs LOCK_system_variables_hash to register plugin variables.
Doesn't seem to need both locks at the same time.
Similar lock order is used in a few places.

SHOW VARIABLES
--------------
Needs LOCK_system_variables_hash to iterate system_variable_hash.
Needs LOCK_global_system_variables to read variable value.
Does seem to need both locks at the same time.
This lock order is not used in other places.

change_user()
-------------
Needs LOCK_global_system_variables to read global_system_variable.table_plugin.
Needs LOCK_plugin to my_plugin_lock(table_plugin).
Does seem to need both locks at the same time.
Similar lock order is used in a few places.


"SHOW VARIABLES" looks correct. So I have only two ideas:
- Fix INSTALL PLUGIN so it releases LOCK_plugin before registering variables.
  Sounds like the best solution, but there are a few more things to fix, e.g.
  UNINTALL PLUGIN.
- Store default storage engine as a string, not Sys_var_plugin.

Thanks,
Sergey


Follow ups