diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 598ec7e5469c87cacb7e845ebcfa6a8bf5937ea8..8b79b0278be10d682588d1e1cf6161c081157345 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -264,12 +264,13 @@ void taos_close(TAOS *taos) { } SSqlObj* pHb = pObj->pHb; - if (pHb != NULL) { + if (pHb != NULL && atomic_val_compare_exchange_ptr(&pObj->pHb, pHb, 0) == pHb) { if (pHb->pRpcCtx != NULL) { // wait for rsp from dnode rpcCancelRequest(pHb->pRpcCtx); + pHb->pRpcCtx = NULL; } - pObj->pHb = NULL; + tscDebug("%p, HB is freed", pHb); taos_free_result(pHb); } diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index a6376e49adeabbb108b18a995de71b9396b74d04..337513940aad2dd6632c83b73dcd2f98441a9c62 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -266,7 +266,6 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen if (taosHashGetSize(pCacheObj->pHashTable) == 0) { atomic_add_fetch_32(&pCacheObj->statistics.missCount, 1); - uError("cache:%s, key:%p, not in cache, retrieved failed, reason: empty cache", pCacheObj->name, key); return NULL; }