diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 37bf9c3f340d28ab651a78c1060520a74ed2e9f4..70e5713ee6bf3d93270719e98b55bfad7df2143f 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -322,6 +322,8 @@ void *rpcMallocCont(int contLen) { if (start == NULL) { tError("failed to malloc msg, size:%d", size); return NULL; + } else { + tDebug("malloc mem: %p", start); } return start + sizeof(SRpcReqContext) + sizeof(SRpcHead); @@ -331,7 +333,7 @@ void rpcFreeCont(void *cont) { if ( cont ) { char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); free(temp); - // tTrace("free mem: %p", temp); + tDebug("free mem: %p", temp); } } @@ -551,7 +553,7 @@ static void rpcFreeMsg(void *msg) { if ( msg ) { char *temp = (char *)msg - sizeof(SRpcReqContext); free(temp); - // tTrace("free mem: %p", temp); + tDebug("free mem: %p", temp); } } @@ -1098,10 +1100,15 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { } if (pHead->code == TSDB_CODE_RPC_REDIRECT) { - pContext->redirect++; - if (pContext->redirect > TSDB_MAX_REPLICA) { - pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - tWarn("%s, too many redirects, quit", pConn->info); + if (rpcMsg.contLen < sizeof(SRpcEpSet)) { + // if EpSet is not included in the msg, treat it as NOT_READY + pHead->code = TSDB_CODE_RPC_NOT_READY; + } else { + pContext->redirect++; + if (pContext->redirect > TSDB_MAX_REPLICA) { + pHead->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + tWarn("%s, too many redirects, quit", pConn->info); + } } }