rpc did not handle simeple request head in right way if its session is already closed in server
coverity scan defect for tqueue.c
This commit is contained in:
parent
2067476335
commit
13cc896cf5
|
@ -43,7 +43,7 @@ int16_t tsNumOfTotalVnodes = TSDB_INVALID_VNODE_NUM;
|
||||||
int32_t tsNumOfMnodes = 3;
|
int32_t tsNumOfMnodes = 3;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
int32_t tsRpcTimer = 300;
|
int32_t tsRpcTimer = 1000;
|
||||||
int32_t tsRpcMaxTime = 600; // seconds;
|
int32_t tsRpcMaxTime = 600; // seconds;
|
||||||
int32_t tsMaxShellConns = 5000;
|
int32_t tsMaxShellConns = 5000;
|
||||||
int32_t tsMaxConnections = 5000;
|
int32_t tsMaxConnections = 5000;
|
||||||
|
|
|
@ -665,6 +665,12 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
|
||||||
return pConn;
|
return pConn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if code is not 0, it means it is simple reqhead, just ignore
|
||||||
|
if (pHead->code != 0) {
|
||||||
|
terrno = TSDB_CODE_RPC_ALREADY_PROCESSED;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int sid = taosAllocateId(pRpc->idPool);
|
int sid = taosAllocateId(pRpc->idPool);
|
||||||
if (sid <= 0) {
|
if (sid <= 0) {
|
||||||
tError("%s maximum number of sessions:%d is reached", pRpc->label, pRpc->sessions);
|
tError("%s maximum number of sessions:%d is reached", pRpc->label, pRpc->sessions);
|
||||||
|
|
|
@ -419,7 +419,7 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) {
|
||||||
tError("%s %p TCP malloc(size:%d) fail", pThreadObj->label, pFdObj->thandle, msgLen);
|
tError("%s %p TCP malloc(size:%d) fail", pThreadObj->label, pFdObj->thandle, msgLen);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
// tDebug("malloc mem: %p", buffer);
|
tDebug("TCP malloc mem: %p", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = buffer + tsRpcOverhead;
|
msg = buffer + tsRpcOverhead;
|
||||||
|
|
|
@ -212,7 +212,7 @@ static void *taosRecvUdpData(void *param) {
|
||||||
tError("%s failed to allocate memory, size:%ld", pConn->label, dataLen);
|
tError("%s failed to allocate memory, size:%ld", pConn->label, dataLen);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
// tTrace("malloc mem: %p", tmsg);
|
tDebug("UDP malloc mem: %p", tmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmsg += tsRpcOverhead; // overhead for SRpcReqContext
|
tmsg += tsRpcOverhead; // overhead for SRpcReqContext
|
||||||
|
|
|
@ -68,10 +68,15 @@ void taosCloseQueue(taos_queue param) {
|
||||||
if (param == NULL) return;
|
if (param == NULL) return;
|
||||||
STaosQueue *queue = (STaosQueue *)param;
|
STaosQueue *queue = (STaosQueue *)param;
|
||||||
STaosQnode *pTemp;
|
STaosQnode *pTemp;
|
||||||
|
STaosQset *qset;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&queue->mutex);
|
||||||
STaosQnode *pNode = queue->head;
|
STaosQnode *pNode = queue->head;
|
||||||
queue->head = NULL;
|
queue->head = NULL;
|
||||||
|
qset = queue->qset;
|
||||||
|
pthread_mutex_unlock(&queue->mutex);
|
||||||
|
|
||||||
if (queue->qset) taosRemoveFromQset(queue->qset, queue);
|
if (queue->qset) taosRemoveFromQset(qset, queue);
|
||||||
|
|
||||||
pthread_mutex_lock(&queue->mutex);
|
pthread_mutex_lock(&queue->mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue