未验证 提交 9662d3f1 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #18520 from taosdata/fix/TD-20801

fix(sync): fix asan error, TD-20801
...@@ -1158,7 +1158,7 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) { ...@@ -1158,7 +1158,7 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
pSyncNode->electTimerParam.pSyncNode = pSyncNode; pSyncNode->electTimerParam.pSyncNode = pSyncNode;
pSyncNode->electTimerParam.pData = NULL; pSyncNode->electTimerParam.pData = NULL;
taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager, taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, (void*)(pSyncNode->rid), syncEnv()->pTimerManager,
&pSyncNode->pElectTimer); &pSyncNode->pElectTimer);
} else { } else {
...@@ -1916,13 +1916,21 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { ...@@ -1916,13 +1916,21 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
static void syncNodeEqElectTimer(void* param, void* tmrId) { static void syncNodeEqElectTimer(void* param, void* tmrId) {
if (!syncIsInit()) return; if (!syncIsInit()) return;
SSyncNode* pNode = (SSyncNode*)param; int64_t rid = (int64_t)param;
SSyncNode* pNode = syncNodeAcquire(rid);
if (pNode == NULL) return; if (pNode == NULL) return;
if (pNode->syncEqMsg == NULL) return;
if (pNode->syncEqMsg == NULL) {
syncNodeRelease(pNode);
return;
}
int64_t tsNow = taosGetTimestampMs(); int64_t tsNow = taosGetTimestampMs();
if (tsNow < pNode->electTimerParam.executeTime) return; if (tsNow < pNode->electTimerParam.executeTime) {
syncNodeRelease(pNode);
return;
}
SRpcMsg rpcMsg = {0}; SRpcMsg rpcMsg = {0};
int32_t code = int32_t code =
...@@ -1930,7 +1938,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { ...@@ -1930,7 +1938,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
if (code != 0) { if (code != 0) {
sError("failed to build elect msg"); sError("failed to build elect msg");
syncNodeRelease(pNode);
return; return;
} }
...@@ -1941,9 +1949,11 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { ...@@ -1941,9 +1949,11 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
if (code != 0) { if (code != 0) {
sError("failed to sync enqueue elect msg since %s", terrstr()); sError("failed to sync enqueue elect msg since %s", terrstr());
rpcFreeCont(rpcMsg.pCont); rpcFreeCont(rpcMsg.pCont);
syncNodeRelease(pNode);
return; return;
} }
syncNodeRelease(pNode);
} }
static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册