fix mem problem
This commit is contained in:
parent
16888801c7
commit
0adc07e712
|
@ -1315,6 +1315,12 @@ void cliSend(SCliConn* pConn) {
|
||||||
|
|
||||||
uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
|
uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
|
||||||
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
|
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
|
||||||
|
if (req == NULL) {
|
||||||
|
tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
|
||||||
|
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||||
|
cliHandleExcept(pConn, -1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int status = uv_write(req, (uv_stream_t*)pConn->stream, &wb, 1, cliSendCb);
|
int status = uv_write(req, (uv_stream_t*)pConn->stream, &wb, 1, cliSendCb);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
|
@ -2224,7 +2230,7 @@ static void* cliWorkThread(void* arg) {
|
||||||
|
|
||||||
SCliThrd* pThrd = (SCliThrd*)arg;
|
SCliThrd* pThrd = (SCliThrd*)arg;
|
||||||
pThrd->pid = taosGetSelfPthreadId();
|
pThrd->pid = taosGetSelfPthreadId();
|
||||||
|
tsEnableRandErr = true;
|
||||||
(void)strtolower(threadName, pThrd->pTransInst->label);
|
(void)strtolower(threadName, pThrd->pTransInst->label);
|
||||||
setThreadName(threadName);
|
setThreadName(threadName);
|
||||||
|
|
||||||
|
|
|
@ -414,6 +414,9 @@ void transReqQueueInit(queue* q) {
|
||||||
}
|
}
|
||||||
void* transReqQueuePush(queue* q) {
|
void* transReqQueuePush(queue* q) {
|
||||||
STransReq* req = taosMemoryCalloc(1, sizeof(STransReq));
|
STransReq* req = taosMemoryCalloc(1, sizeof(STransReq));
|
||||||
|
if (req == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
req->wreq.data = req;
|
req->wreq.data = req;
|
||||||
QUEUE_PUSH(q, &req->q);
|
QUEUE_PUSH(q, &req->q);
|
||||||
return &req->wreq;
|
return &req->wreq;
|
||||||
|
|
|
@ -696,6 +696,14 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) {
|
||||||
|
|
||||||
transRefSrvHandle(pConn);
|
transRefSrvHandle(pConn);
|
||||||
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
|
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
|
||||||
|
if (req == NULL) {
|
||||||
|
if (!uv_is_closing((uv_handle_t*)(pConn->pTcp))) {
|
||||||
|
tError("conn %p failed to write data, reason:%s", pConn, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||||
|
pConn->broken = true;
|
||||||
|
transUnrefSrvHandle(pConn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
(void)uv_write(req, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb);
|
(void)uv_write(req, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb);
|
||||||
}
|
}
|
||||||
static void uvStartSendResp(SSvrMsg* smsg) {
|
static void uvStartSendResp(SSvrMsg* smsg) {
|
||||||
|
@ -1174,6 +1182,7 @@ static int32_t addHandleToAcceptloop(void* arg) {
|
||||||
void* transWorkerThread(void* arg) {
|
void* transWorkerThread(void* arg) {
|
||||||
setThreadName("trans-svr-work");
|
setThreadName("trans-svr-work");
|
||||||
SWorkThrd* pThrd = (SWorkThrd*)arg;
|
SWorkThrd* pThrd = (SWorkThrd*)arg;
|
||||||
|
tsEnableRandErr = true;
|
||||||
(void)uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
(void)uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue