Deadlock chain:
wrlock(LOCK_grant) -> lock(acl_cache->lock) GRANT/REVOKE CREATE/DROP USER
|
lock(LOCK_open) -> rdlock(LOCK_grant) SELECT * FROM INFORMATION_SCHEMA.COLUMNS
|
wrlock(LOCK_logger) -> lock(LOCK_open) SET @@global.slow_query_log='ON'
|
lock(acl_cache->lock) -> rdlock(LOCK_logger) Failed connection
|
MTR test to reproduce this deadlock:
--source include/have_plugin_auth.inc
|
--source include/have_debug_sync.inc
|
|
SET @@global.slow_query_log='OFF';
|
CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
|
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
|
GRANT PROXY ON plug_dest TO plug_user;
|
RENAME USER plug_dest TO new_dest;
|
|
connect(con1, localhost, root,,);
|
connect(con2, localhost, root,,);
|
connect(con3, localhost, root,,);
|
|
connection con1;
|
SET debug_sync='mysql_grant SIGNAL ready1 WAIT_FOR go1';
|
SET debug_dbug='+d,mysql_grant';
|
send REVOKE ALL ON *.* FROM no_such_user@localhost;
|
|
connection con2;
|
SET debug_sync='now WAIT_FOR ready1';
|
SET debug_sync='fill_schema_table_from_frm SIGNAL ready2 WAIT_FOR go2';
|
send SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS;
|
|
connection con3;
|
SET debug_sync='now WAIT_FOR ready2';
|
SET debug_sync='activate_log_handler SIGNAL ready3 WAIT_FOR go3';
|
SET debug_dbug='+d,activate_log_handler';
|
send SET @@global.slow_query_log='ON';
|
|
connection default;
|
SET debug_sync='now WAIT_FOR ready3';
|
--error 1
|
--exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT 1;"
|
|
connection con1;
|
--error 1141
|
reap;
|
disconnect con1;
|
|
connection con2;
|
reap;
|
disconnect con2;
|
|
connection con3;
|
reap;
|
disconnect con3;
|
|
connection default;
|
DROP USER plug_user, new_dest;
|
SET debug_sync='RESET';
|
Debug sync points:
=== modified file 'sql/log.cc'
|
--- sql/log.cc 2014-08-02 19:26:16 +0000
|
+++ sql/log.cc 2014-09-18 15:16:51 +0000
|
@@ -1400,7 +1400,12 @@ bool LOGGER::activate_log_handler(THD* t
|
{
|
MYSQL_QUERY_LOG *file_log;
|
bool res= FALSE;
|
+ DEBUG_SYNC(thd, "activate_log_handler");
|
lock_exclusive();
|
+ DBUG_EXECUTE_IF("activate_log_handler",
|
+ {
|
+ debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL ready3"));
|
+ };);
|
switch (log_type) {
|
case QUERY_LOG_SLOW:
|
if (!opt_slow_log)
|
|
=== modified file 'sql/sql_acl.cc'
|
--- sql/sql_acl.cc 2014-08-02 19:26:16 +0000
|
+++ sql/sql_acl.cc 2014-09-18 15:18:52 +0000
|
@@ -53,6 +53,7 @@
|
#include "sql_array.h"
|
|
#include "sql_plugin_compat.h"
|
+#include "debug_sync.h"
|
|
bool mysql_user_table_is_in_short_password_format= false;
|
|
@@ -4142,8 +4143,13 @@ bool mysql_grant(THD *thd, const char *d
|
if (!revoke_grant)
|
create_new_users= test_if_create_new_users(thd);
|
|
+ DEBUG_SYNC(thd, "mysql_grant");
|
/* go through users in user_list */
|
mysql_rwlock_wrlock(&LOCK_grant);
|
+ DBUG_EXECUTE_IF("mysql_grant",
|
+ {
|
+ debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL ready1"));
|
+ };);
|
mysql_mutex_lock(&acl_cache->lock);
|
grant_version++;
|
|
@@ -9225,7 +9231,12 @@ bool acl_authenticate(THD *thd, uint con
|
if (!acl_proxy_user)
|
{
|
if (!thd->is_error())
|
+ {
|
+ debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL go1 WAIT_FOR ready1"));
|
+ debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL go2"));
|
+ debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL go3 WAIT_FOR ready3"));
|
login_failed_error(thd);
|
+ }
|
mysql_mutex_unlock(&acl_cache->lock);
|
DBUG_RETURN(1);
|
}
|
|
=== modified file 'sql/sql_show.cc'
|
--- sql/sql_show.cc 2014-08-31 17:55:11 +0000
|
+++ sql/sql_show.cc 2014-09-18 15:07:47 +0000
|
@@ -4244,6 +4244,7 @@ static int fill_schema_table_from_frm(TH
|
key_length= create_table_def_key(thd, key, &table_list, 0);
|
hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
|
mysql_mutex_lock(&LOCK_open);
|
+ DEBUG_SYNC(thd, "fill_schema_table_from_frm");
|
share= get_table_share(thd, &table_list, key,
|
key_length, OPEN_VIEW, ¬_used, hash_value);
|
if (!share)
|
- is part of
-
MDEV-5089
possible deadlocks between rwlocks and mutexes
-
-
Closed
{"report":{"fcp":1994.6000003814697,"ttfb":864.5,"pageVisibility":"visible","entityId":44901,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"572b8fdb-b2b7-45ad-9aea-e57f56e13cb2","navigationType":0,"readyForUser":2152.800000190735,"redirectCount":0,"resourceLoadedEnd":2412.7000007629395,"resourceLoadedStart":891.9000005722046,"resourceTiming":[{"duration":464.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":891.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":891.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1356.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":511.3999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":892.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":892.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1403.5,"responseStart":0,"secureConnectionStart":0},{"duration":520.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":892.4000005722046,"connectEnd":892.4000005722046,"connectStart":892.4000005722046,"domainLookupEnd":892.4000005722046,"domainLookupStart":892.4000005722046,"fetchStart":892.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":892.4000005722046,"responseEnd":1412.8000001907349,"responseStart":1412.8000001907349,"secureConnectionStart":892.4000005722046},{"duration":562.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":892.6000003814697,"connectEnd":892.6000003814697,"connectStart":892.6000003814697,"domainLookupEnd":892.6000003814697,"domainLookupStart":892.6000003814697,"fetchStart":892.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":892.6000003814697,"responseEnd":1455.5,"responseStart":1455.5,"secureConnectionStart":892.6000003814697},{"duration":566.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":892.7000007629395,"connectEnd":892.7000007629395,"connectStart":892.7000007629395,"domainLookupEnd":892.7000007629395,"domainLookupStart":892.7000007629395,"fetchStart":892.7000007629395,"redirectEnd":0,"redirectStart":0,"requestStart":892.7000007629395,"responseEnd":1459.6000003814697,"responseStart":1459.6000003814697,"secureConnectionStart":892.7000007629395},{"duration":567.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":892.9000005722046,"connectEnd":892.9000005722046,"connectStart":892.9000005722046,"domainLookupEnd":892.9000005722046,"domainLookupStart":892.9000005722046,"fetchStart":892.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":892.9000005722046,"responseEnd":1460.1000003814697,"responseStart":1460.1000003814697,"secureConnectionStart":892.9000005722046},{"duration":567.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":893.1000003814697,"connectEnd":893.1000003814697,"connectStart":893.1000003814697,"domainLookupEnd":893.1000003814697,"domainLookupStart":893.1000003814697,"fetchStart":893.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":893.1000003814697,"responseEnd":1460.4000005722046,"responseStart":1460.4000005722046,"secureConnectionStart":893.1000003814697},{"duration":570.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":893.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":893.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1463.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":567.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":893.4000005722046,"connectEnd":893.4000005722046,"connectStart":893.4000005722046,"domainLookupEnd":893.4000005722046,"domainLookupStart":893.4000005722046,"fetchStart":893.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":893.4000005722046,"responseEnd":1460.9000005722046,"responseStart":1460.9000005722046,"secureConnectionStart":893.4000005722046},{"duration":570.3999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":893.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":893.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1464,"responseStart":0,"secureConnectionStart":0},{"duration":567.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":893.7000007629395,"connectEnd":893.7000007629395,"connectStart":893.7000007629395,"domainLookupEnd":893.7000007629395,"domainLookupStart":893.7000007629395,"fetchStart":893.7000007629395,"redirectEnd":0,"redirectStart":0,"requestStart":893.7000007629395,"responseEnd":1461.4000005722046,"responseStart":1461.4000005722046,"secureConnectionStart":893.7000007629395},{"duration":988.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":894.6000003814697,"connectEnd":894.6000003814697,"connectStart":894.6000003814697,"domainLookupEnd":894.6000003814697,"domainLookupStart":894.6000003814697,"fetchStart":894.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":894.6000003814697,"responseEnd":1883.5,"responseStart":1883.5,"secureConnectionStart":894.6000003814697},{"duration":1518,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":894.7000007629395,"connectEnd":894.7000007629395,"connectStart":894.7000007629395,"domainLookupEnd":894.7000007629395,"domainLookupStart":894.7000007629395,"fetchStart":894.7000007629395,"redirectEnd":0,"redirectStart":0,"requestStart":894.7000007629395,"responseEnd":2412.7000007629395,"responseStart":2412.7000007629395,"secureConnectionStart":894.7000007629395},{"duration":675,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1679.7000007629395,"connectEnd":1679.7000007629395,"connectStart":1679.7000007629395,"domainLookupEnd":1679.7000007629395,"domainLookupStart":1679.7000007629395,"fetchStart":1679.7000007629395,"redirectEnd":0,"redirectStart":0,"requestStart":1679.7000007629395,"responseEnd":2354.7000007629395,"responseStart":2354.7000007629395,"secureConnectionStart":1679.7000007629395},{"duration":481.69999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1985.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1985.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2467.6000003814697,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":616,"responseStart":864,"responseEnd":866,"domLoading":889,"domInteractive":2467,"domContentLoadedEventStart":2467,"domContentLoadedEventEnd":2508,"domComplete":4332,"loadEventStart":4332,"loadEventEnd":4334,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2416.9000005722046},{"name":"bigPipe.sidebar-id.end","time":2417.7000007629395},{"name":"bigPipe.activity-panel-pipe-id.start","time":2417.9000005722046},{"name":"bigPipe.activity-panel-pipe-id.end","time":2421},{"name":"activityTabFullyLoaded","time":2515.9000005722046}],"measures":[],"correlationId":"275dbc88eef5c","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":157,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}