From d173526f99e7f439682ebf46b976f1806c8eea13 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 8 Feb 2018 11:51:36 +0100 Subject: [PATCH] destruct callbacks (and their closures) to ensure there are no reference cycles when destructing the consumer. This solves a hang in rd_kafka_destroy --- src/consumer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/consumer.cpp b/src/consumer.cpp index c9efe05..94dda1c 100644 --- a/src/consumer.cpp +++ b/src/consumer.cpp @@ -66,6 +66,11 @@ Consumer::Consumer(Configuration config) Consumer::~Consumer() { try { + // make sure to destroy the function closures. in case they hold kafka + // objects, they will need to be destroyed before we destroy the handle + assignment_callback_ = nullptr; + revocation_callback_ = nullptr; + rebalance_error_callback_ = nullptr; close(); } catch (const Exception&) {