fix: rsma invalid read issue

This commit is contained in:
dapan1121 2023-02-22 18:13:24 +08:00
parent d4fdf17cae
commit 532fb08309
1 changed files with 5 additions and 5 deletions

View File

@ -279,10 +279,7 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
// step 1: set rsma trigger stat cancelled // step 1: set rsma trigger stat cancelled
atomic_store_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_CANCELLED); atomic_store_8(RSMA_TRIGGER_STAT(pStat), TASK_TRIGGER_STAT_CANCELLED);
// step 2: destroy the rsma info and associated fetch tasks // step 2: wait for all triggered fetch tasks to finish
taosHashCleanup(RSMA_INFO_HASH(pStat));
// step 3: wait for all triggered fetch tasks to finish
int32_t nLoops = 0; int32_t nLoops = 0;
while (1) { while (1) {
if (T_REF_VAL_GET((SSmaStat *)pStat) == 0) { if (T_REF_VAL_GET((SSmaStat *)pStat) == 0) {
@ -298,9 +295,12 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
} }
} }
// step 4: // step 3:
tdRsmaStopExecutor(pSma); tdRsmaStopExecutor(pSma);
// step 4: destroy the rsma info and associated fetch tasks
taosHashCleanup(RSMA_INFO_HASH(pStat));
// step 5: // step 5:
tdRSmaFSClose(RSMA_FS(pStat)); tdRSmaFSClose(RSMA_FS(pStat));