From 8db6a395aa7fcbd7b350a10a09848fffeed1b408 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 3 Jul 2024 19:04:16 +0800 Subject: [PATCH] fix:[TD-30879]check if hash is freed before inc counter --- source/client/src/clientMonitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/client/src/clientMonitor.c b/source/client/src/clientMonitor.c index a102995c0d..479ea76fe3 100644 --- a/source/client/src/clientMonitor.c +++ b/source/client/src/clientMonitor.c @@ -307,6 +307,11 @@ end: void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) { taosWLockLatch(&monitorLock); + if (atomic_load_32(&monitorFlag) == 1) { + taosRUnLockLatch(&monitorLock); + return; + } + MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES); if (ppMonitor == NULL || *ppMonitor == NULL) { tscError("monitorCounterInc not found pMonitor %"PRId64, clusterId);