Merge pull request #28939 from taosdata/fixx/TD-33005-3.0
handle random memory failure
This commit is contained in:
commit
6e6386eed1
|
@ -1816,7 +1816,7 @@ int32_t doProcessMsgFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) {
|
|||
.handleRefId = pMsg->info.refId,
|
||||
.pEpSet = pEpSet};
|
||||
|
||||
if (pMsg->contLen > 0) {
|
||||
if (pMsg->code != TSDB_CODE_OUT_OF_MEMORY && pMsg->contLen > 0) {
|
||||
buf.pData = taosMemoryCalloc(1, pMsg->contLen);
|
||||
if (buf.pData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -2211,7 +2211,7 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo) {
|
|||
static int32_t doConvertJson(SReqResultInfo* pResultInfo) {
|
||||
int32_t numOfRows = pResultInfo->numOfRows;
|
||||
int32_t numOfCols = pResultInfo->numOfCols;
|
||||
bool needConvert = false;
|
||||
bool needConvert = false;
|
||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||
if (pResultInfo->fields[i].type == TSDB_DATA_TYPE_JSON) {
|
||||
needConvert = true;
|
||||
|
@ -2400,8 +2400,8 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, bool convertUcs4) {
|
|||
p += sizeof(int32_t);
|
||||
|
||||
if (rows != pResultInfo->numOfRows || cols != pResultInfo->numOfCols) {
|
||||
tscError("setResultDataPtr paras error:rows;%d numOfRows:%" PRId64 " cols:%d numOfCols:%d", rows, pResultInfo->numOfRows, cols,
|
||||
pResultInfo->numOfCols);
|
||||
tscError("setResultDataPtr paras error:rows;%d numOfRows:%" PRId64 " cols:%d numOfCols:%d", rows,
|
||||
pResultInfo->numOfRows, cols, pResultInfo->numOfCols);
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -2577,8 +2577,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
|
|||
// TODO handle the compressed case
|
||||
pResultInfo->totalRows += pResultInfo->numOfRows;
|
||||
|
||||
int32_t code =
|
||||
setResultDataPtr(pResultInfo, convertUcs4);
|
||||
int32_t code = setResultDataPtr(pResultInfo, convertUcs4);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -2017,7 +2017,9 @@ void cliHandleBatchReq(SCliThrd* pThrd, SCliReq* pReq) {
|
|||
tWarn("%s conn %p failed to added to heap cache since %s", pInst->label, pConn, tstrerror(code));
|
||||
}
|
||||
} else {
|
||||
// TAOS_CHECK_GOTO(code, &lino, _exception);
|
||||
if (code == TSDB_CODE_OUT_OF_MEMORY && pConn == NULL) {
|
||||
TAOS_CHECK_GOTO(code, &lino, _exception);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2496,10 +2498,6 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
_end:
|
||||
if (pThrd) {
|
||||
TAOS_UNUSED(taosThreadMutexDestroy(&pThrd->msgMtx));
|
||||
|
||||
TAOS_UNUSED(uv_loop_close(pThrd->loop));
|
||||
taosMemoryFree(pThrd->loop);
|
||||
TAOS_UNUSED((taosThreadMutexDestroy(&pThrd->msgMtx)));
|
||||
transAsyncPoolDestroy(pThrd->asyncPool);
|
||||
for (int i = 0; i < taosArrayGetSize(pThrd->timerList); i++) {
|
||||
uv_timer_t* timer = taosArrayGetP(pThrd->timerList, i);
|
||||
|
@ -2509,6 +2507,9 @@ _end:
|
|||
taosArrayDestroy(pThrd->timerList);
|
||||
|
||||
TAOS_UNUSED(destroyConnPool(pThrd));
|
||||
TAOS_UNUSED(uv_loop_close(pThrd->loop));
|
||||
taosMemoryFree(pThrd->loop);
|
||||
|
||||
transDQDestroy(pThrd->delayQueue, NULL);
|
||||
transDQDestroy(pThrd->timeoutQueue, NULL);
|
||||
transDQDestroy(pThrd->waitConnQueue, NULL);
|
||||
|
|
|
@ -1320,8 +1320,6 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, &lino, _end);
|
||||
}
|
||||
|
||||
QUEUE_INIT(&exh->q);
|
||||
|
||||
SExHandle* pSelf = transAcquireExHandle(uvGetConnRefOfThrd(pThrd), exh->refId);
|
||||
if (pSelf != exh) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end);
|
||||
|
@ -1369,6 +1367,12 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
return pConn;
|
||||
_end:
|
||||
if (pConn) {
|
||||
if (pConn->refId > 0) {
|
||||
transReleaseExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
|
||||
transRemoveExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
|
||||
pConn->refId = -1;
|
||||
}
|
||||
|
||||
transQueueDestroy(&pConn->resps);
|
||||
transDestroyBuffer(&pConn->readBuf);
|
||||
taosHashCleanup(pConn->pQTable);
|
||||
|
@ -1378,7 +1382,7 @@ _end:
|
|||
taosMemoryFree(pConn);
|
||||
pConn = NULL;
|
||||
}
|
||||
tError("%s failed to create conn since %s" PRId64, transLabel(pInst), tstrerror(code));
|
||||
tError("%s failed to create conn since %s", transLabel(pInst), tstrerror(code));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue