未验证 提交 1c882d40 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #8943 from taosdata/fix/TS-654

[TS-654]<fix>: fixed two crash bugs
...@@ -409,6 +409,7 @@ static bool httpReadData(HttpContext *pContext) { ...@@ -409,6 +409,7 @@ static bool httpReadData(HttpContext *pContext) {
continue; continue;
} else if (errno == EAGAIN || errno == EWOULDBLOCK) { } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
httpDebug("context:%p, fd:%d, read from socket error:%d, wait another event", pContext, pContext->fd, errno); httpDebug("context:%p, fd:%d, read from socket error:%d, wait another event", pContext, pContext->fd, errno);
httpReleaseContext(pContext/*, false */);
return false; return false;
} else { } else {
httpError("context:%p, fd:%d, read from socket error:%d, close connect", pContext, pContext->fd, errno); httpError("context:%p, fd:%d, read from socket error:%d, close connect", pContext, pContext->fd, errno);
......
...@@ -488,6 +488,12 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) { ...@@ -488,6 +488,12 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) {
msgLen = (int32_t)htonl((uint32_t)rpcHead.msgLen); msgLen = (int32_t)htonl((uint32_t)rpcHead.msgLen);
int32_t size = msgLen + tsRpcOverhead; int32_t size = msgLen + tsRpcOverhead;
// TODO: reason not found yet, workaround to avoid first
if (msgLen <= 0 || size < 0) {
tError("%s %p invalid size for malloc, msgLen:%d, size:%d", pThreadObj->label, pFdObj->thandle, msgLen, size);
return -1;
}
buffer = malloc(size); buffer = malloc(size);
if (NULL == buffer) { if (NULL == buffer) {
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册