提交 ab90ce5a 编写于 作者: S Shengliang Guan

fix: avoid deadlock

上级 8c2b5bf7
......@@ -80,7 +80,7 @@ typedef struct {
} SProfileMgmt;
typedef struct {
SRWLatch lock;
TdThreadMutex lock;
char email[TSDB_FQDN_LEN];
} STelemMgmt;
......
......@@ -127,8 +127,10 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
STelemMgmt* pMgmt = &pMnode->telemMgmt;
if (!tsEnableTelem) return 0;
taosWLockLatch(&pMgmt->lock);
taosThreadMutexLock(&pMgmt->lock);
char* pCont = mndBuildTelemetryReport(pMnode);
taosThreadMutexUnlock(&pMgmt->lock);
if (pCont != NULL) {
if (taosSendHttpReport(tsTelemServer, tsTelemPort, pCont, strlen(pCont), HTTP_FLAT) != 0) {
mError("failed to send telemetry report");
......@@ -137,18 +139,20 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
}
taosMemoryFree(pCont);
}
taosWUnLockLatch(&pMgmt->lock);
return 0;
}
int32_t mndInitTelem(SMnode* pMnode) {
STelemMgmt* pMgmt = &pMnode->telemMgmt;
taosInitRWLatch(&pMgmt->lock);
taosThreadMutexInit(&pMgmt->lock, NULL);
taosGetEmail(pMgmt->email, sizeof(pMgmt->email));
mndSetMsgHandle(pMnode, TDMT_MND_TELEM_TIMER, mndProcessTelemTimer);
return 0;
}
void mndCleanupTelem(SMnode* pMnode) {}
void mndCleanupTelem(SMnode* pMnode) {
STelemMgmt* pMgmt = &pMnode->telemMgmt;
taosThreadMutexDestroy(&pMgmt->lock);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册