[td-1319]

This commit is contained in:
Haojun Liao 2020-09-14 15:54:46 +08:00
parent 7d56810a6e
commit fbb76bb9b2
2 changed files with 18 additions and 20 deletions

View File

@ -265,22 +265,22 @@ void taos_close(TAOS *taos) {
} }
// free all sqlObjs created by using this connect before free the STscObj // free all sqlObjs created by using this connect before free the STscObj
while(1) { // while(1) {
pthread_mutex_lock(&pObj->mutex); // pthread_mutex_lock(&pObj->mutex);
void* p = pObj->sqlList; // void* p = pObj->sqlList;
pthread_mutex_unlock(&pObj->mutex); // pthread_mutex_unlock(&pObj->mutex);
//
if (p == NULL) { // if (p == NULL) {
break; // break;
} // }
//
tscDebug("%p waiting for sqlObj to be freed, %p", pObj, p); // tscDebug("%p waiting for sqlObj to be freed, %p", pObj, p);
taosMsleep(100); // taosMsleep(100);
//
// todo fix me!! two threads call taos_free_result will cause problem. // // todo fix me!! two threads call taos_free_result will cause problem.
tscDebug("%p free :%p", pObj, p); // tscDebug("%p free :%p", pObj, p);
taos_free_result(p); // taos_free_result(p);
} // }
int32_t ref = T_REF_DEC(pObj); int32_t ref = T_REF_DEC(pObj);
assert(ref >= 0); assert(ref >= 0);
@ -605,8 +605,6 @@ void taos_free_result(TAOS_RES *res) {
return; return;
} }
// assert(pSql->self != 0 && *pSql->self == pSql);
bool freeNow = tscKillQueryInDnode(pSql); bool freeNow = tscKillQueryInDnode(pSql);
if (freeNow) { if (freeNow) {
tscDebug("%p free sqlObj in cache", pSql); tscDebug("%p free sqlObj in cache", pSql);

View File

@ -366,7 +366,7 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) {
tscResetSqlCmdObj(pCmd, false); tscResetSqlCmdObj(pCmd, false);
} }
static void tscFreeSubobj(SSqlObj* pSql) { static UNUSED_FUNC void tscFreeSubobj(SSqlObj* pSql) {
if (pSql->numOfSubs == 0) { if (pSql->numOfSubs == 0) {
return; return;
} }
@ -438,7 +438,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
tscDebug("%p start to free sqlObj", pSql); tscDebug("%p start to free sqlObj", pSql);
STscObj* pTscObj = pSql->pTscObj; STscObj* pTscObj = pSql->pTscObj;
tscFreeSubobj(pSql); // tscFreeSubobj(pSql);
tscPartiallyFreeSqlObj(pSql); tscPartiallyFreeSqlObj(pSql);
pSql->signature = NULL; pSql->signature = NULL;