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-06-17 15:54:01 +02:00
2009-12-09 18:48:42 +03:00
2009-10-15 17:23:43 +05:00
2009-10-22 23:30:28 +01:00
2009-11-25 13:53:23 +03:00
2009-12-03 21:37:38 +03:00
2009-09-23 23:32:31 +02:00
2009-10-30 19:13:58 +01: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-11-19 21:48:08 -02:00
2009-12-08 12:57:07 +03:00
2009-02-13 11:41:47 -05:00
2008-11-10 21:21:49 +01:00
2009-11-20 00:13:54 +01:00
2009-12-16 11:33:54 +03:00
2009-06-17 15:54:01 +02: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-02-13 11:41:47 -05:00
2009-06-09 18:11:21 +02:00
2009-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-09-23 23:32:31 +02:00
2009-09-23 23:32:31 +02:00
2009-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-10-22 23:30:28 +01: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-25 13:53:23 +03:00
2009-11-24 16:54:59 +03:00
2009-12-01 22:41:39 +03:00
2009-12-02 18:50:14 +03:00
2009-11-03 12:37:02 +01:00
2009-12-16 10:48:07 +03:00
2009-11-30 14:34:39 +02:00
2009-10-24 09:57:31 +03:00
2009-09-23 23:32:31 +02:00
2009-09-23 23:32:31 +02:00
2009-11-24 16:54:59 +03:00
2009-10-22 23:30:28 +01:00
2009-12-01 22:41:39 +03:00
2009-09-23 23:32:31 +02:00
2009-11-17 15:24:23 +04:00
2009-11-17 15:24:23 +04:00
2009-11-19 21:48:08 -02:00
2009-11-02 11:09:15 +01:00
2009-11-06 22:34:25 +03:00
2009-09-23 23:32:31 +02:00
2009-12-02 00:25:51 +03:00
2009-12-02 18:50:14 +03:00
2009-10-15 17:23:43 +05: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-11-06 18:35:04 +02:00
2009-12-08 12:57:07 +03:00
2009-11-22 03:59:48 +00:00
2009-12-03 21:37:38 +03:00
2009-12-16 12:32:11 +01:00
2009-12-10 11:21:38 +03:00
2009-09-23 23:32:31 +02:00
2009-09-10 03:18:29 -06:00
2009-11-02 09:21:39 -02:00
2009-12-15 22:59:07 +03:00
2009-10-06 13:04:51 +02:00
2009-09-23 23:32:31 +02: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-09-23 23:32:31 +02:00
2009-11-10 11:34:26 +03:00
2009-11-24 16:54:59 +03:00
2009-11-10 18:31:28 -02:00
2009-06-19 13:24:43 +05:00
2009-04-13 18:09:10 +05:00
2009-10-28 18:32:48 +01:00
2009-12-02 08:14:22 +01:00
2009-10-28 18:22:36 +01:00
2009-06-01 16:00:38 +04:00
2009-10-28 10:55:44 +03:00
2009-12-02 11:00:44 +01: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-12-01 21:07:18 +02:00
2009-09-23 23:32:31 +02:00
2009-11-02 21:05:42 +01:00
2008-12-29 17:04:10 +01:00
2009-10-14 20:37:38 +04:00
2009-12-05 10:28:53 +08:00
2009-09-26 12:49:49 +08:00
2009-12-05 02:02:48 +03:00
2009-10-14 15:14:58 +04:00
2009-11-04 12:28:20 +00:00
2009-11-04 12:28:20 +00:00
2009-09-29 15:18:44 +01:00
2009-09-29 15:18:44 +01:00
2009-06-16 16:04:30 +01:00
2009-06-16 16:04:30 +01:00
2009-12-05 02:02:48 +03: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-03-25 12:53:56 +02:00
2009-09-23 23:32:31 +02:00
2009-12-05 02:02:48 +03:00
2009-12-01 21:07:18 +02: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-12-01 22:41:39 +03: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-09-23 23:32:31 +02:00
2009-09-23 23:32:31 +02:00
2009-12-16 12:32:11 +01:00
2009-11-30 18:55:03 +03:00
2009-12-04 01:46:14 +03:00
2009-10-29 12:19:36 +01:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-11-25 13:53:23 +03:00
2009-04-23 12:43:42 +05:00
2009-09-23 23:32:31 +02: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-10-15 17:23:43 +05: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-11-27 15:23:20 +01:00
2009-12-16 11:33:54 +03:00
2009-10-22 00:02:06 +04:00
2009-11-10 18:31:28 -02:00
2009-12-03 14:37:42 +03:00
2009-11-06 12:52:45 +03:00
2008-12-04 19:41:53 +01:00
2009-11-24 16:54:59 +03:00
2009-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-12-16 11:33:54 +03:00
2009-11-02 14:49:26 +01:00
2009-12-04 02:52:05 +03:00
2009-11-02 21:05:42 +01: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-10-22 00:02:06 +04: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-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-12-02 00:25:51 +03:00
2009-12-16 11:33:54 +03:00
2009-09-23 23:32:31 +02:00
2009-12-15 22:03:56 +03:00
2008-11-10 21:21:49 +01:00
2009-09-10 03:18:29 -06:00
2009-09-10 03:18:29 -06:00
2009-09-23 23:32:31 +02:00
2009-11-24 16:54:59 +03:00
2009-11-11 21:19:41 +01:00
2009-12-15 22:59:07 +03:00
2009-11-21 12:28:01 +08: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-09-23 23:32:31 +02: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-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-09-23 15:21:29 +02:00
2009-11-30 14:34:39 +02: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-05 02:02:48 +03:00
2009-12-03 21:37:38 +03:00
2009-09-23 23:32:31 +02:00
2009-12-16 11:33:54 +03:00
2009-09-23 23:32:31 +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-11-23 19:57:31 +03:00