1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00
Files
mariadb/sql
Jon Olav Hauglid ddea504a7d Bug #48541 Deadlock between LOCK_open and LOCK_mdl
The reason for the deadlock was an improper exit from
MDL_context::wait_for_locks() which caused mysys_var->current_mutex to remain
LOCK_mdl even though LOCK_mdl was no longer held by that connection. 

This could for example lead to a deadlock in the following way:
1) INSERT DELAYED tries to open a table but fails, and trying to recover it
calls wait_for_locks().
2) Due to a pending exclusive request, wait_for_locks() fails and exits without
resetting mysys_var->current_mutex for the delayed insert handler thread. So it
continues to point to LOCK_mdl.
3) The handler thread manages to open a table.
4) A different connection takes LOCK_open and tries to take LOCK_mdl.
5) FLUSH TABLES from a third connection notices that the handler thread has a
table open, and tries to kill it. This involves locking mysys_var->current_mutex
while having LOCK_open locked. Since current_mutex mistakenly points to LOCK_mdl,
we have a deadlock.

This patch makes sure MDL_EXIT_COND() is called before exiting wait_for_locks().
This clears mysys->current_mutex which resolves the issue. 

An assert is added to recover_from_failed_open_table_attempt() after
wait_for_locks() is called, to check that current_mutex is indeed reset.
With this assert in place, existing tests in (e.g.) mdl_sync.test will fail
without this patch.
2009-12-16 12:32:11 +01:00
..
2009-12-09 18:48:42 +03:00
2009-12-03 21:37:38 +03:00
2009-09-29 17:38:40 +02:00
2009-11-24 16:54:59 +03:00
2009-11-24 16:54:59 +03:00
2009-11-24 16:54:59 +03:00
2009-12-08 12:57:07 +03:00
2009-12-16 11:33:54 +03:00
2009-11-24 16:54:59 +03:00
2009-12-02 18:22:15 +03:00
2009-11-24 16:54:59 +03:00
2009-12-16 11:33:54 +03:00
2009-12-03 02:09:22 +03:00
2009-11-30 22:38:25 +03:00
2009-12-03 21:37:38 +03:00
2009-12-15 22:03:56 +03:00
2009-10-14 20:37:38 +04:00
2009-11-24 16:54:59 +03:00
2009-11-03 12:37:02 +01:00
2009-12-16 10:48:07 +03:00
2009-10-24 09:57:31 +03:00
2009-11-24 16:54:59 +03:00
2009-11-17 15:24:23 +04:00
2009-11-17 15:24:23 +04:00
2009-11-02 11:09:15 +01:00
2009-12-02 18:50:14 +03:00
2009-12-10 11:21:38 +03:00
2009-12-11 13:39:45 +03:00
2009-12-08 12:57:07 +03:00
2009-12-08 12:57:07 +03:00
2009-12-08 12:57:07 +03:00
2009-12-03 21:37:38 +03:00
2009-12-10 11:21:38 +03:00
2009-09-10 03:18:29 -06:00
2009-12-15 22:59:07 +03:00
2009-12-15 22:59:07 +03:00
2009-11-02 14:10:04 +03:00
2008-11-22 01:10:38 +01:00
2009-11-24 16:54:59 +03:00
2009-10-28 18:32:48 +01:00
2009-06-01 16:00:38 +04:00
2009-10-28 10:55:44 +03:00
2009-10-28 10:55:44 +03:00
2009-11-24 16:54:59 +03:00
2009-11-06 19:13:33 +03:00
2009-10-14 20:37:38 +04:00
2009-09-26 12:49:49 +08:00
2009-10-14 15:14:58 +04:00
2009-12-03 14:37:42 +03:00
2009-10-14 20:37:38 +04:00
2009-10-14 20:37:38 +04:00
2009-12-16 11:33:54 +03:00
2009-11-23 19:57:31 +03:00
2009-10-14 20:37:38 +04:00
2009-12-16 11:33:54 +03:00
2009-12-09 19:11:26 +03:00
2009-11-24 16:54:59 +03:00
2009-09-10 03:18:29 -06:00
2009-09-10 03:18:29 -06:00
2009-12-15 22:59:07 +03:00
2009-12-09 19:11:26 +03:00
2009-08-28 18:21:54 +02:00
2009-06-17 16:56:44 +02:00
2009-12-16 11:33:54 +03:00
2009-10-28 10:55:44 +03:00
2009-06-17 16:56:44 +02:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-12-01 17:39:03 +03:00
2009-12-02 18:22:15 +03:00
2009-12-11 15:24:23 +03:00
2009-09-10 03:18:29 -06:00
2009-12-03 21:37:38 +03:00
2009-10-23 15:22:21 +04:00
2009-12-10 14:26:00 +01:00
2009-12-08 12:57:07 +03:00
2009-12-15 22:03:56 +03:00
2009-12-16 11:33:54 +03:00
2009-12-03 14:37:42 +03:00
2009-11-24 16:54:59 +03:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-12-04 02:52:05 +03:00
2009-12-16 11:33:54 +03:00
2009-11-02 21:05:42 +01:00
2009-12-10 11:53:20 +01:00
2009-12-03 00:24:10 +03:00
2009-12-03 00:24:10 +03:00
2009-12-01 22:13:01 +03:00
2009-12-02 18:50:14 +03:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-12-15 22:03:56 +03:00
2009-09-10 03:18:29 -06:00
2009-09-10 03:18:29 -06:00
2009-11-24 16:54:59 +03:00
2009-12-15 22:59:07 +03:00
2009-12-16 11:33:54 +03:00
2009-12-10 11:53:20 +01:00
2009-12-08 17:13:12 +03:00
2009-12-16 11:33:54 +03:00
2009-05-15 12:11:07 +05:00
2009-12-08 12:57:07 +03:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-12-15 22:03:56 +03:00
2009-09-10 03:18:29 -06:00
2009-11-06 17:20:27 +03:00
2009-12-03 21:37:38 +03:00
2009-12-16 11:33:54 +03:00
2009-11-24 16:54:59 +03:00
2009-11-24 16:54:59 +03:00
2009-11-24 16:54:59 +03:00
2009-11-23 19:57:31 +03:00