Bug #71384 DROP DATABASE + CREATE TABLE + SHOW GLOBAL VARIABLES deadlock
Submitted: 14 Jan 2014 23:12 Modified: 16 Jan 2014 18:40
Reporter: Domas Mituzas Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.63 OS:Any
Assigned to: CPU Architecture:Any

[14 Jan 2014 23:12] Domas Mituzas
Description:
SHOW GLOBAL VARIABLES tries to lock LOCK_event_metadata, while holding LOCK_global_system_variables
DROP DATABASE tries to lock LOCK_open, while holding LOCK_event_metadata
CREATE TABLE tries to lock LOCK_global_system_variables, while holding LOCK_open

Full stack traces - http://p.defau.lt/?2YIq_vChtxUhMfi0KOQ2yQ

How to repeat:

two threads doing 'CREATE DATABASE; CREATE TABLE; DROP DATABASE'
one thread doing 'SHOW GLOBAL VARIABLES'

Suggested fix:
don't build cyclical locks!!!!!
[14 Jan 2014 23:19] Mark Callaghan
Even better when rarely used features (events) add locks that mysqld that lead to deadlock
[16 Jan 2014 18:40] Sveta Smirnova
Thank you for the report.

There is no LOCK_event_metadata in version 5.5 and up. I also tried to repeat described behavior using provided scenario and could not. Since EOL of version 5.1 is 2013-12-31 I close this bug as "Unsupported". Please upgrade.