From ad1c82b6db4f6736a4e48b2eea1eae7f11bb9268 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 21 Sep 2020 13:20:23 +0800 Subject: [PATCH] [td-225] fix bugs in regression test. --- src/client/src/tscServer.c | 4 ++-- src/client/src/tscSql.c | 31 +++++++------------------------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 12712c6542..ddbee3106d 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -188,8 +188,8 @@ void tscProcessActivityTimer(void *handle, void *tmrId) { if (tscShouldFreeHeartBeat(pHB)) { tscDebug("%p free HB object and release connection", pHB); - tscFreeSqlObj(pHB); - tscCloseTscObj(pObj); + pObj->pHb = 0; + taos_free_result(pHB); } else { int32_t code = tscProcessSql(pHB); if (code != TSDB_CODE_SUCCESS) { diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 69bc69cd4a..682211adbd 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -255,32 +255,15 @@ void taos_close(TAOS *taos) { return; } - if (pObj->pHb != NULL) { - if (pObj->pHb->pRpcCtx != NULL) { // wait for rsp from dnode - rpcCancelRequest(pObj->pHb->pRpcCtx); + SSqlObj* pHb = pObj->pHb; + if (pHb != NULL) { + if (pHb->pRpcCtx != NULL) { // wait for rsp from dnode + rpcCancelRequest(pHb->pRpcCtx); } - tscSetFreeHeatBeat(pObj); - tscFreeSqlObj(pObj->pHb); - } - - // free all sqlObjs created by using this connect before free the STscObj -// while(1) { -// pthread_mutex_lock(&pObj->mutex); -// void* p = pObj->sqlList; -// pthread_mutex_unlock(&pObj->mutex); -// -// if (p == NULL) { -// break; -// } -// -// tscDebug("%p waiting for sqlObj to be freed, %p", pObj, p); -// taosMsleep(100); -// -// // todo fix me!! two threads call taos_free_result will cause problem. -// tscDebug("%p free :%p", pObj, p); -// taos_free_result(p); -// } + pObj->pHb = NULL; + taos_free_result(pHb); + } int32_t ref = T_REF_DEC(pObj); assert(ref >= 0); -- GitLab