From 706b535c61e8587a859099ebe6afb6a48d6a5cc7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 29 May 2020 11:10:34 +0000 Subject: [PATCH] fix deadlock while free tsc object --- src/client/src/tscSql.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a9ec33c078..7534a32409 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -591,7 +591,10 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) { tscProcessSql(pSql); // waits for response and then goes on - sem_wait(&pSql->rspSem); + STscObj* pTscObj = pSql->pTscObj; + if (pTscObj->pSql == pSql) { + sem_wait(&pSql->rspSem); + } } else { // if no free resource msg is sent to vnode, we free this object immediately. STscObj* pTscObj = pSql->pTscObj;