提交 7fadd4cb 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

remove a potential rpcSendRecv deadlock if rpcClose is called by another thread

上级 4e0f1055
...@@ -630,6 +630,7 @@ static void rpcReleaseConn(SRpcConn *pConn) { ...@@ -630,6 +630,7 @@ static void rpcReleaseConn(SRpcConn *pConn) {
} else { } else {
// if there is an outgoing message, free it // if there is an outgoing message, free it
if (pConn->outType && pConn->pReqMsg) { if (pConn->outType && pConn->pReqMsg) {
SRpcReqContext *pContext = pConn->pContext;
if (pContext->pRsp) { if (pContext->pRsp) {
// for synchronous API, post semaphore to unblock app // for synchronous API, post semaphore to unblock app
pContext->pRsp->code = TSDB_CODE_RPC_APP_ERROR; pContext->pRsp->code = TSDB_CODE_RPC_APP_ERROR;
...@@ -637,8 +638,8 @@ static void rpcReleaseConn(SRpcConn *pConn) { ...@@ -637,8 +638,8 @@ static void rpcReleaseConn(SRpcConn *pConn) {
pContext->pRsp->contLen = 0; pContext->pRsp->contLen = 0;
tsem_post(pContext->pSem); tsem_post(pContext->pSem);
} }
pConn->pContext->pConn = NULL; pContext->pConn = NULL;
taosRemoveRef(tsRpcRefId, pConn->pContext->rid); taosRemoveRef(tsRpcRefId, pContext->rid);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册