From facecc2dcda0cb4d2b13aee3e20a3c6ec1553fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 8 Jan 2018 22:22:33 +0200 Subject: [PATCH] Make sure double DCB closes are detected Crashing after a double close makes sure it is properly detected in debug builds. --- server/core/dcb.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 2e8ab61fd..161df9dad 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -3020,8 +3020,15 @@ static uint32_t dcb_process_poll_events(DCB *dcb, uint32_t events) { MXS_WARNING("Events reported for dcb(%p), owned by %d, that has been closed %" PRIu32 " times.", dcb, dcb->poll.thread.id, dcb->n_close); + ss_dassert(!true); + return rc; } + /** + * Any of these callbacks might close the DCB. Hence, the value of 'n_close' + * must be checked after each callback invocation. + */ + if ((events & EPOLLOUT) && (dcb->n_close == 0)) { int eno = 0;