diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index 8dfb0b7d67f988d694f462fafd6e78ea969d7c5d..7de9ef762a29c47bf56eb63630be2e45cf269b39 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -283,18 +283,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; @@ -307,6 +297,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 07aff292f8319f1615b24dfe8907af9164ce8bcb..92a6f6e149306a7449c823311aaa92061974d39d 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);