From 931f4e354f1f4c274c6a5d819cd96c77353f75be Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 23 Jan 2025 14:45:30 +0800 Subject: [PATCH 1/2] fix:[TD-33600] windows error if taos exist without connection --- source/client/src/clientTmq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 93117c934f..e708eee70e 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1627,8 +1627,8 @@ void tmqMgmtClose(void) { tmqMgmt.timer = NULL; } - (void) taosThreadMutexLock(&tmqMgmt.lock); - if (tmqMgmt.rsetId >= 0) { + if (tmqMgmt.rsetId > 0) { + (void) taosThreadMutexLock(&tmqMgmt.lock); tmq_t *tmq = taosIterateRef(tmqMgmt.rsetId, 0); int64_t refId = 0; @@ -1647,8 +1647,8 @@ void tmqMgmtClose(void) { } taosCloseRef(tmqMgmt.rsetId); tmqMgmt.rsetId = -1; + (void)taosThreadMutexUnlock(&tmqMgmt.lock); } - (void)taosThreadMutexUnlock(&tmqMgmt.lock); } tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { From b8a5bcfbf9dfa7fd0b2af195d86f4bf5484b4057 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 23 Jan 2025 14:55:24 +0800 Subject: [PATCH 2/2] fix:[TD-33600] windows error if taos exist without connection --- source/client/src/clientTmq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index e708eee70e..fcd88ed8d7 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1601,6 +1601,11 @@ void tmqFreeImpl(void* handle) { static void tmqMgmtInit(void) { tmqInitRes = 0; + + if (taosThreadMutexInit(&tmqMgmt.lock, NULL) != 0){ + goto END; + } + tmqMgmt.timer = taosTmrInit(1000, 100, 360000, "TMQ"); if (tmqMgmt.timer == NULL) { @@ -1612,10 +1617,6 @@ static void tmqMgmtInit(void) { goto END; } - if (taosThreadMutexInit(&tmqMgmt.lock, NULL) != 0){ - goto END; - } - return; END: tmqInitRes = terrno;