From b8b2b8a23aaad0250f45a70855c194c2d7db4bab Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 21 Feb 2023 23:00:57 +0800 Subject: [PATCH 1/3] fix: fix invalid free --- source/libs/transport/src/transCli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 9e74825a1f..5d6751a260 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -985,6 +985,7 @@ _RETURN: } static void cliDestroyBatch(SCliBatch* pBatch) { + if (pBatch == NULL) return; while (!QUEUE_IS_EMPTY(&pBatch->wq)) { queue* h = QUEUE_HEAD(&pBatch->wq); QUEUE_REMOVE(h); @@ -2310,6 +2311,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx)); pCtx->epSet = *pEpSet; + pCtx->origEpSet = *pEpSet; pCtx->ahandle = pReq->info.ahandle; pCtx->msgType = pReq->msgType; From 27c12787f7c4e5894cc3693373e400b31d931e32 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 22 Feb 2023 16:40:13 +0800 Subject: [PATCH 2/3] fix: fix double send resp --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 1 - source/libs/transport/src/trans.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index cd29b11550..8f091c82d9 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -160,7 +160,6 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp dGError("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d contLen:%d", pHead->vgId, pMsg, terrstr(), TMSG_INFO(pMsg->msgType), qtype, pHead->contLen); terrno = (terrno != 0) ? terrno : -1; - vmSendResponse(pMsg); return terrno; } diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index 16ea25a41a..4c89d02b6c 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -88,6 +88,11 @@ void* rpcOpen(const SRpcInit* pInit) { pRpc->connType = pInit->connType; pRpc->idleTime = pInit->idleTime; + pRpc->parent = pInit->parent; + if (pInit->user) { + tstrncpy(pRpc->user, pInit->user, sizeof(pRpc->user)); + } + pRpc->tcphandle = (*taosInitHandle[pRpc->connType])(ip, pInit->localPort, pRpc->label, pRpc->numOfThreads, NULL, pRpc); @@ -95,10 +100,6 @@ void* rpcOpen(const SRpcInit* pInit) { taosMemoryFree(pRpc); return NULL; } - pRpc->parent = pInit->parent; - if (pInit->user) { - tstrncpy(pRpc->user, pInit->user, sizeof(pRpc->user)); - } int64_t refId = transAddExHandle(transGetInstMgt(), pRpc); transAcquireExHandle(transGetInstMgt(), refId); From e8b6d8fa64448b221ba72e72e13aa35e498731bc Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 22 Feb 2023 19:36:20 +0800 Subject: [PATCH 3/3] fix: fix double send resp --- source/libs/transport/src/trans.c | 4 ---- source/libs/transport/src/transComm.c | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c index 4c89d02b6c..f5f3b52f50 100644 --- a/source/libs/transport/src/trans.c +++ b/source/libs/transport/src/trans.c @@ -13,8 +13,6 @@ * along with this program. If not, see . */ -#ifdef USE_UV - #include "transComm.h" void* (*taosInitHandle[])(uint32_t ip, uint32_t port, char* label, int32_t numOfThreads, void* fp, void* shandle) = { @@ -189,5 +187,3 @@ void rpcCleanup(void) { return; } - -#endif diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 4c107a88f1..0dfc7677b3 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -12,7 +12,6 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifdef USE_UV #include "transComm.h" @@ -67,7 +66,7 @@ int32_t transDecompressMsg(char** msg, int32_t len) { char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead)); STransMsgHead* pNewHead = (STransMsgHead*)buf; - int32_t decompLen = LZ4_decompress_safe(pCont + sizeof(STransCompMsg), pNewHead->content, + int32_t decompLen = LZ4_decompress_safe(pCont + sizeof(STransCompMsg), (char*)pNewHead->content, len - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen); memcpy((char*)pNewHead, (char*)pHead, sizeof(STransMsgHead)); @@ -655,4 +654,3 @@ void transDestoryExHandle(void* handle) { } taosMemoryFree(handle); } -#endif