diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index d2fdc2fc93f2e86d181df2734aea1eb5026a1edf..553c61d16049f7b087751116d88b656b103be8be 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -282,18 +282,8 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { // } pthread_mutex_lock(&pSql->subState.mutex); if (pSql->pSubs != NULL && pSql->subState.states != NULL) { - for (int32_t i = 0; i < pQdesc->numOfSub; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { // because subState maybe free on anytime by any thread, check validate from here - if(pSql->subState.numOfSub != pQdesc->numOfSub || - pSql->pSubs == NULL || - pSql->subState.states == NULL) { - tscError(" QUERY-HEART STscObj=%p subState maybe free. numOfSub=%d pSubs=%p states=%p", - pObj, pSql->subState.numOfSub, pSql->pSubs, pSql->subState.states); - pQdesc->numOfSub = 0; - // break for - break; - } - SSqlObj *psub = pSql->pSubs[i]; int64_t self = (psub != NULL)? psub->self : 0; @@ -306,6 +296,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { p += len; } } + pQdesc->numOfSub = pSql->subState.numOfSub; pthread_mutex_unlock(&pSql->subState.mutex); } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 83e8105d48d482aefb159c9bb48864432c96f8f4..9cd36cce2ba83b9dacebd7297b06e0c7e332e55e 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -357,7 +357,7 @@ void checkBrokenQueries(STscObj *pTscObj) { pthread_mutex_lock(&pSql->subState.mutex); if (pSql->pSubs) { // have sub sql - for (int i = 0; i < numOfSub; i++) { + for (int i = 0; i < pSql->subState.numOfSub; i++) { SSqlObj *pSubSql = pSql->pSubs[i]; if(pSubSql) { tscInfo("PROBE 0x%" PRIx64 " sub sql app is 0x%" PRIx64, pSql->self, pSubSql->self);