diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 365857a14e1ae872365581ab68e3adfd4e3aa941..71e1651ce1c54d6a556b0a8c13a8c4543daa86de 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -576,11 +576,12 @@ static void rpcReleaseConn(SRpcConn *pConn) { taosHashRemove(pRpc->hash, hashstr, size); rpcFreeMsg(pConn->pRspMsg); // it may have a response msg saved, but not request msg } - - taosFreeId(pRpc->idPool, pConn->sid); + + int sid = pConn->sid; int64_t lockedBy = pConn->lockedBy; memset(pConn, 0, sizeof(SRpcConn)); pConn->lockedBy = lockedBy; + taosFreeId(pRpc->idPool, sid); tTrace("%s, rpc connection is released", pConn->info); }