Merge pull request #29222 from taosdata/fix/main/TD-33280

Fix(cfg): fix  core at dmConfigThreadFp.
This commit is contained in:
Shengliang Guan 2024-12-20 13:48:06 +08:00 committed by GitHub
commit 648412750b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -69,6 +69,7 @@ int32_t dmStartStatusThread(SDnodeMgmt *pMgmt);
int32_t dmStartConfigThread(SDnodeMgmt *pMgmt); int32_t dmStartConfigThread(SDnodeMgmt *pMgmt);
int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt); int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt);
void dmStopStatusThread(SDnodeMgmt *pMgmt); void dmStopStatusThread(SDnodeMgmt *pMgmt);
void dmStopConfigThread(SDnodeMgmt *pMgmt);
void dmStopStatusInfoThread(SDnodeMgmt *pMgmt); void dmStopStatusInfoThread(SDnodeMgmt *pMgmt);
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt); int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt);
void dmStopNotifyThread(SDnodeMgmt *pMgmt); void dmStopNotifyThread(SDnodeMgmt *pMgmt);

View File

@ -52,6 +52,7 @@ static void dmStopMgmt(SDnodeMgmt *pMgmt) {
dmStopMonitorThread(pMgmt); dmStopMonitorThread(pMgmt);
dmStopAuditThread(pMgmt); dmStopAuditThread(pMgmt);
dmStopStatusThread(pMgmt); dmStopStatusThread(pMgmt);
dmStopConfigThread(pMgmt);
dmStopStatusInfoThread(pMgmt); dmStopStatusInfoThread(pMgmt);
#if defined(TD_ENTERPRISE) #if defined(TD_ENTERPRISE)
dmStopNotifyThread(pMgmt); dmStopNotifyThread(pMgmt);

View File

@ -343,7 +343,7 @@ int32_t dmStartConfigThread(SDnodeMgmt *pMgmt) {
int32_t code = 0; int32_t code = 0;
TdThreadAttr thAttr; TdThreadAttr thAttr;
(void)taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_DETACHED); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&pMgmt->configThread, &thAttr, dmConfigThreadFp, pMgmt) != 0) { if (taosThreadCreate(&pMgmt->configThread, &thAttr, dmConfigThreadFp, pMgmt) != 0) {
code = TAOS_SYSTEM_ERROR(errno); code = TAOS_SYSTEM_ERROR(errno);
dError("failed to create config thread since %s", tstrerror(code)); dError("failed to create config thread since %s", tstrerror(code));
@ -378,6 +378,13 @@ void dmStopStatusThread(SDnodeMgmt *pMgmt) {
} }
} }
void dmStopConfigThread(SDnodeMgmt *pMgmt) {
if (taosCheckPthreadValid(pMgmt->configThread)) {
(void)taosThreadJoin(pMgmt->configThread, NULL);
taosThreadClear(&pMgmt->configThread);
}
}
void dmStopStatusInfoThread(SDnodeMgmt *pMgmt) { void dmStopStatusInfoThread(SDnodeMgmt *pMgmt) {
if (taosCheckPthreadValid(pMgmt->statusInfoThread)) { if (taosCheckPthreadValid(pMgmt->statusInfoThread)) {
(void)taosThreadJoin(pMgmt->statusInfoThread, NULL); (void)taosThreadJoin(pMgmt->statusInfoThread, NULL);