diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index 7a46dbe5c3e1238da93043f8dc97047f84ff72e8..f6bf59ae6024bdcdb21d45bb532d5d7182257415 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -186,9 +186,11 @@ static void *taosRecvUdpData(void *param) { SUdpConn *pConn = param; struct sockaddr_in sourceAdd; ssize_t dataLen; + int32_t msgLen; unsigned int addLen; uint16_t port; SRecvInfo recvInfo; + SRpcHead *pHead; memset(&sourceAdd, 0, sizeof(sourceAdd)); addLen = sizeof(sourceAdd); @@ -216,6 +218,13 @@ static void *taosRecvUdpData(void *param) { continue; } + pHead = (SRpcHead *)msg; + msgLen = (int32_t)htonl((uint32_t)pHead->msgLen); + if (dataLen < msgLen) { + tError("%s recvfrom failed(%s): dataLen: %ld, msgLen: %d", pConn->label, strerror(errno), (long)dataLen, msgLen); + continue; + } + int32_t size = dataLen + tsRpcOverhead; char *tmsg = malloc(size); if (NULL == tmsg) { diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim index 8d063020e73be449bc95463e966d9081b0cd5be5..7a716bd065a767266c50ca34677ed34b77e89bc8 100644 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim @@ -51,7 +51,7 @@ sleep 1000 sql connect sleep 1000 sql create dnode $hostname2 -sleep 1000 +sleep 2000 print ============== step2: create database with replica 2, and create table, insert data $totalTableNum = 10 @@ -268,4 +268,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode8 -s stop -x SIGINT diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim index 8f837b7e477ab801b296b32ddcf9a5c683c351f0..7581528d8237d736bb93cce200733510cb209b56 100644 --- a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim +++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim @@ -51,7 +51,7 @@ sleep 1000 sql connect sleep 1000 sql create dnode $hostname2 -sleep 1000 +sleep 2000 print ============== step2: create database with replica 2, and create table, insert data $totalTableNum = 10 @@ -266,4 +266,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT system sh/exec.sh -n dnode6 -s stop -x SIGINT system sh/exec.sh -n dnode7 -s stop -x SIGINT -system sh/exec.sh -n dnode8 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode8 -s stop -x SIGINT