From 968a972765a1c453a118702ae20c73a6ebdeb405 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 28 Dec 2021 17:02:16 +0800 Subject: [PATCH] [TD-12191](query, insert): CQ caused taosd stuck in infinite loop when elapsed function used --- src/client/src/tscProfile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index b00138b4c4..c682138a35 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -170,6 +170,16 @@ void tscAddIntoStreamList(SSqlStream *pStream) { STscObj * pObj = pStream->pSql->pTscObj; pthread_mutex_lock(&pObj->mutex); + //check if newly added stream node is present + //in the streamList to prevent loop in the list + SSqlStream *iter = pObj->streamList; + while (iter) { + if (pStream == iter) { + pthread_mutex_unlock(&pObj->mutex); + return; + } + iter = iter->next; + } pStream->next = pObj->streamList; if (pObj->streamList) pObj->streamList->prev = pStream; -- GitLab