From bf8a0581cd13e173c68f9ef6fafba1ef4764cd71 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 13 Nov 2022 17:28:18 +0300 Subject: [PATCH] Fix possible "assertion failed: next->prev_wait >= 0" in client --- src/cluster_client.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cluster_client.cpp b/src/cluster_client.cpp index 4163f3e5..45f19b58 100644 --- a/src/cluster_client.cpp +++ b/src/cluster_client.cpp @@ -221,9 +221,11 @@ void cluster_client_t::erase_op(cluster_op_t *op) if (op_queue_tail == op) op_queue_tail = op->prev; op->next = op->prev = NULL; - std::function(op->callback)(op); if (!(flags & OP_IMMEDIATE_COMMIT)) inc_wait(opcode, flags, next, -1); + // Call callback at the end to avoid inconsistencies in prev_wait + // if the callback adds more operations itself + std::function(op->callback)(op); } void cluster_client_t::continue_ops(bool up_retry)