From aa8546ca80209e704baca2287847aa4a6f73e799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 19 Oct 2018 15:06:27 +0300 Subject: [PATCH] MXS-2107: Prevent moving of client DCBs with poll_add_dcb When a DCB is removed and added more than once with poll_add_dcb and poll_remove_dcb, the code previously chose a different thread each time the DCB was added. This violated the assumption is that all DCBs are local to a single worker. --- server/core/dcb.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 0838ec4f1..468f0bbfc 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -3597,6 +3597,11 @@ int poll_add_dcb(DCB* dcb) // See: https://jira.mariadb.org/browse/MXS-1805 and https://jira.mariadb.org/browse/MXS-1833 owner = RoutingWorker::get(RoutingWorker::MAIN); } + else if (dcb->state == DCB_STATE_NOPOLLING) + { + // This DCB was removed and added back to epoll. Assign it to the same worker it started with. + owner = static_cast(dcb->poll.owner); + } else { // Round-robin the client connection worker assignment