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;