From d59a1ce2acafdf6f288f5448e78ec78bb832cd8c Mon Sep 17 00:00:00 2001 From: Pavel Melkozerov Date: Sat, 29 Jun 2024 14:59:31 +0300 Subject: [PATCH] reactor: fix crash during metrics gathering The crash is caused by statistics request while scheduling_group is removed. The tasks_pending metric gathering triggers reactor::pending_task_count() call. This call causes null pointer derefence as the task queue pointer has been reset in reactor::destroy_scheduling_group() --- src/core/reactor.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/reactor.cc b/src/core/reactor.cc index fcc6b0b82ad..ee606622243 100644 --- a/src/core/reactor.cc +++ b/src/core/reactor.cc @@ -2545,7 +2545,9 @@ uint64_t reactor::pending_task_count() const { uint64_t ret = 0; for (auto&& tq : _task_queues) { - ret += tq->_q.size(); + if (tq) { + ret += tq->_q.size(); + } } return ret; }