fix:[TD-30879]check if hash is freed before inc counter

This commit is contained in:
wangmm0220 2024-07-03 19:04:16 +08:00
parent cfbd475fc2
commit 8db6a395aa
1 changed files with 5 additions and 0 deletions

View File

@ -307,6 +307,11 @@ end:
void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) { void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) {
taosWLockLatch(&monitorLock); taosWLockLatch(&monitorLock);
if (atomic_load_32(&monitorFlag) == 1) {
taosRUnLockLatch(&monitorLock);
return;
}
MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES); MonitorClient** ppMonitor = (MonitorClient**)taosHashGet(monitorCounterHash, &clusterId, LONG_BYTES);
if (ppMonitor == NULL || *ppMonitor == NULL) { if (ppMonitor == NULL || *ppMonitor == NULL) {
tscError("monitorCounterInc not found pMonitor %"PRId64, clusterId); tscError("monitorCounterInc not found pMonitor %"PRId64, clusterId);