diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 716808bc9..d34b6f9f6 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -3456,6 +3456,18 @@ int poll_add_dcb(DCB *dcb) new_state = DCB_STATE_LISTENING; worker_id = MXS_WORKER_ALL; } + else if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER && + (strcasecmp(dcb->service->routerModule, "cli") == 0)) + { + // If the DCB refers to an accepted maxadmin socket, we force it + // to the main thread. That's done in order to prevent a deadlock + // that may happen if there are multiple concurrent maxadmin calls, + // handled by different worker threads. + // See: https://jira.mariadb.org/browse/MXS-1805 + new_state = DCB_STATE_POLLING; + dcb->poll.thread.id = 0; + worker_id = dcb->poll.thread.id; + } else { ss_dassert(dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER ||