From 3398de8a35ba6409a745a5625a06a14eaa0f99c4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 15 Sep 2022 21:35:54 +0800 Subject: [PATCH] fix(tsc): avoid mem leak --- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 2 +- source/libs/transport/src/transCli.c | 4 +--- source/libs/transport/src/transSvr.c | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index b91b82b72e..f57943b9dd 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -270,7 +270,7 @@ int32_t dmInitClient(SDnode *pDnode) { SRpcInit rpcInit = {0}; rpcInit.label = "DND-C"; - rpcInit.numOfThreads = 1; + rpcInit.numOfThreads = 4; rpcInit.cfp = (RpcCfp)dmProcessRpcMsg; rpcInit.sessions = 1024; rpcInit.connType = TAOS_CONN_CLIENT; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index dcfa93431b..191011111d 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1498,9 +1498,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran pCtx->ahandle = pReq->info.ahandle; pCtx->msgType = pReq->msgType; - if (ctx != NULL) { - pCtx->appCtx = *ctx; - } + if (ctx != NULL) pCtx->appCtx = *ctx; SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg)); cliMsg->ctx = pCtx; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index d3277d1cc1..70a47fe079 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1148,6 +1148,7 @@ int transReleaseSrvHandle(void* handle) { tTrace("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); + transReleaseExHandle(transGetRefMgt(), refId); return 0; _return1: @@ -1177,8 +1178,10 @@ int transSendResponse(const STransMsg* msg) { STraceId* trace = (STraceId*)&msg->info.traceId; tGTrace("conn %p start to send resp (1/2)", exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); + transReleaseExHandle(transGetRefMgt(), refId); return 0; + _return1: tTrace("handle %p failed to send resp", exh); rpcFreeCont(msg->pCont); @@ -1207,6 +1210,7 @@ int transRegisterMsg(const STransMsg* msg) { STrans* pTransInst = pThrd->pTransInst; tTrace("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle); transAsyncSend(pThrd->asyncPool, &m->q); + transReleaseExHandle(transGetRefMgt(), refId); return 0; -- GitLab