未验证 提交 7aa8791f 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1400 from taosdata/hotfix/rpcdeadlock

fix the deadlock bug for rpcCloseConn
...@@ -287,7 +287,7 @@ void rpcClose(void *param) { ...@@ -287,7 +287,7 @@ void rpcClose(void *param) {
(*taosCleanUpConn[pRpc->connType])(pRpc->udphandle); (*taosCleanUpConn[pRpc->connType])(pRpc->udphandle);
for (int i = 0; i < pRpc->sessions; ++i) { for (int i = 0; i < pRpc->sessions; ++i) {
if (pRpc->connList[i].user[0]) { if (pRpc->connList && pRpc->connList[i].user[0]) {
rpcCloseConn((void *)(pRpc->connList + i)); rpcCloseConn((void *)(pRpc->connList + i));
} }
} }
...@@ -495,9 +495,10 @@ static void rpcCloseConn(void *thandle) { ...@@ -495,9 +495,10 @@ static void rpcCloseConn(void *thandle) {
SRpcConn *pConn = (SRpcConn *)thandle; SRpcConn *pConn = (SRpcConn *)thandle;
SRpcInfo *pRpc = pConn->pRpc; SRpcInfo *pRpc = pConn->pRpc;
if (pConn->user[0] == 0) return;
rpcLockConn(pConn); rpcLockConn(pConn);
if (pConn->user[0]) {
pConn->user[0] = 0; pConn->user[0] = 0;
if (taosCloseConn[pConn->connType]) (*taosCloseConn[pConn->connType])(pConn->chandle); if (taosCloseConn[pConn->connType]) (*taosCloseConn[pConn->connType])(pConn->chandle);
...@@ -522,7 +523,6 @@ static void rpcCloseConn(void *thandle) { ...@@ -522,7 +523,6 @@ static void rpcCloseConn(void *thandle) {
pConn->pContext = NULL; pConn->pContext = NULL;
tTrace("%s %p, rpc connection is closed", pRpc->label, pConn); tTrace("%s %p, rpc connection is closed", pRpc->label, pConn);
}
rpcUnlockConn(pConn); rpcUnlockConn(pConn);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册