Merge pull request #27300 from taosdata/fix/TD-31533/deathlock
fix: unlock
This commit is contained in:
commit
f013c12f5e
|
@ -120,9 +120,13 @@ static int32_t monitorReportAsyncCB(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
.data = NULL};
|
.data = NULL};
|
||||||
if (monitorPutData2MonitorQueue(tmp) == 0) {
|
if (monitorPutData2MonitorQueue(tmp) == 0) {
|
||||||
p->fileName = NULL;
|
p->fileName = NULL;
|
||||||
|
} else {
|
||||||
|
if(taosCloseFile(&(p->pFile)) != 0) {
|
||||||
|
tscError("failed to close file:%p", p->pFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITOR_TYPE type, void* param) {
|
static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITOR_TYPE type, void* param) {
|
||||||
|
@ -164,7 +168,10 @@ static int32_t sendReport(void* pTransporter, SEpSet* epSet, char* pCont, MONITO
|
||||||
int64_t transporterId = 0;
|
int64_t transporterId = 0;
|
||||||
return asyncSendMsgToServer(pTransporter, epSet, &transporterId, pInfo);
|
return asyncSendMsgToServer(pTransporter, epSet, &transporterId, pInfo);
|
||||||
|
|
||||||
FAILED:
|
FAILED:
|
||||||
|
if (taosCloseFile(&(((MonitorSlowLogData*)param)->pFile)) != 0) {
|
||||||
|
tscError("failed to close file:%p", ((MonitorSlowLogData*)param)->pFile);
|
||||||
|
}
|
||||||
monitorFreeSlowLogDataEx(param);
|
monitorFreeSlowLogDataEx(param);
|
||||||
return TAOS_GET_TERRNO(TSDB_CODE_TSC_INTERNAL_ERROR);
|
return TAOS_GET_TERRNO(TSDB_CODE_TSC_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -315,7 +322,7 @@ void monitorCreateClientCounter(int64_t clusterId, const char* name, const char*
|
||||||
void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) {
|
void monitorCounterInc(int64_t clusterId, const char* counterName, const char** label_values) {
|
||||||
taosWLockLatch(&monitorLock);
|
taosWLockLatch(&monitorLock);
|
||||||
if (atomic_load_32(&monitorFlag) == 1) {
|
if (atomic_load_32(&monitorFlag) == 1) {
|
||||||
taosRUnLockLatch(&monitorLock);
|
taosWUnLockLatch(&monitorLock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,11 +469,17 @@ static int64_t getFileSize(char* path) {
|
||||||
static int32_t sendSlowLog(int64_t clusterId, char* data, TdFilePtr pFile, int64_t offset, SLOW_LOG_QUEUE_TYPE type,
|
static int32_t sendSlowLog(int64_t clusterId, char* data, TdFilePtr pFile, int64_t offset, SLOW_LOG_QUEUE_TYPE type,
|
||||||
char* fileName, void* pTransporter, SEpSet* epSet) {
|
char* fileName, void* pTransporter, SEpSet* epSet) {
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
|
if (taosCloseFile(&pFile) != 0) {
|
||||||
|
tscError("failed to close file:%p", pFile);
|
||||||
|
}
|
||||||
taosMemoryFree(fileName);
|
taosMemoryFree(fileName);
|
||||||
return TSDB_CODE_INVALID_PARA;
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
MonitorSlowLogData* pParam = taosMemoryMalloc(sizeof(MonitorSlowLogData));
|
MonitorSlowLogData* pParam = taosMemoryMalloc(sizeof(MonitorSlowLogData));
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
|
if (taosCloseFile(&pFile) != 0) {
|
||||||
|
tscError("failed to close file:%p", pFile);
|
||||||
|
}
|
||||||
taosMemoryFree(data);
|
taosMemoryFree(data);
|
||||||
taosMemoryFree(fileName);
|
taosMemoryFree(fileName);
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -485,6 +498,9 @@ static int32_t monitorReadSend(int64_t clusterId, TdFilePtr pFile, int64_t* offs
|
||||||
SAppInstInfo* pInst = getAppInstByClusterId(clusterId);
|
SAppInstInfo* pInst = getAppInstByClusterId(clusterId);
|
||||||
if (pInst == NULL) {
|
if (pInst == NULL) {
|
||||||
tscError("failed to get app instance by clusterId:%" PRId64, clusterId);
|
tscError("failed to get app instance by clusterId:%" PRId64, clusterId);
|
||||||
|
if (taosCloseFile(&pFile) != 0) {
|
||||||
|
tscError("failed to close file:%p", pFile);
|
||||||
|
}
|
||||||
taosMemoryFree(fileName);
|
taosMemoryFree(fileName);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +726,7 @@ static void* monitorThreadFunc(void* param) {
|
||||||
MonitorSlowLogData* slowLogData = NULL;
|
MonitorSlowLogData* slowLogData = NULL;
|
||||||
(void)taosReadQitem(monitorQueue, (void**)&slowLogData);
|
(void)taosReadQitem(monitorQueue, (void**)&slowLogData);
|
||||||
if (slowLogData != NULL) {
|
if (slowLogData != NULL) {
|
||||||
if (slowLogData->type == SLOW_LOG_READ_BEGINNIG) {
|
if (slowLogData->type == SLOW_LOG_READ_BEGINNIG && quitCnt == 0) {
|
||||||
if (slowLogData->pFile != NULL) {
|
if (slowLogData->pFile != NULL) {
|
||||||
monitorSendSlowLogAtBeginning(slowLogData->clusterId, &(slowLogData->fileName), slowLogData->pFile,
|
monitorSendSlowLogAtBeginning(slowLogData->clusterId, &(slowLogData->fileName), slowLogData->pFile,
|
||||||
slowLogData->offset);
|
slowLogData->offset);
|
||||||
|
@ -729,9 +745,9 @@ static void* monitorThreadFunc(void* param) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
monitorFreeSlowLogData(slowLogData);
|
monitorFreeSlowLogData(slowLogData);
|
||||||
taosFreeQitem(slowLogData);
|
taosFreeQitem(slowLogData);
|
||||||
|
}
|
||||||
|
|
||||||
if (quitCnt == 0) {
|
if (quitCnt == 0) {
|
||||||
monitorSendAllSlowLog();
|
monitorSendAllSlowLog();
|
||||||
|
@ -853,6 +869,9 @@ int32_t monitorPutData2MonitorQueue(MonitorSlowLogData data) {
|
||||||
if (taosWriteQitem(monitorQueue, slowLogData) == 0) {
|
if (taosWriteQitem(monitorQueue, slowLogData) == 0) {
|
||||||
(void)tsem2_post(&monitorSem);
|
(void)tsem2_post(&monitorSem);
|
||||||
} else {
|
} else {
|
||||||
|
if (taosCloseFile(&(slowLogData->pFile)) != 0) {
|
||||||
|
tscError("failed to close file:%p", slowLogData->pFile);
|
||||||
|
}
|
||||||
monitorFreeSlowLogData(slowLogData);
|
monitorFreeSlowLogData(slowLogData);
|
||||||
taosFreeQitem(slowLogData);
|
taosFreeQitem(slowLogData);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue