fix client deadlock
This commit is contained in:
parent
cfedc4d67a
commit
1c200b4198
|
@ -211,27 +211,27 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
|
||||||
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
|
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
|
||||||
#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
|
#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
|
||||||
#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
|
#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
|
||||||
#define CONN_SHOULD_RELEASE(conn, head) \
|
#define CONN_SHOULD_RELEASE(conn, head) \
|
||||||
do { \
|
do { \
|
||||||
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
|
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
|
||||||
uint64_t ahandle = head->ahandle; \
|
uint64_t ahandle = head->ahandle; \
|
||||||
CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle); \
|
CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle); \
|
||||||
transClearBuffer(&conn->readBuf); \
|
transClearBuffer(&conn->readBuf); \
|
||||||
transFreeMsg(transContFromHead((char*)head)); \
|
transFreeMsg(transContFromHead((char*)head)); \
|
||||||
if (transQueueSize(&conn->cliMsgs) > 0 && ahandle == 0) { \
|
if (transQueueSize(&conn->cliMsgs) > 0 && ahandle == 0) { \
|
||||||
SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, 0); \
|
SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, 0); \
|
||||||
if (cliMsg->type == Release) return; \
|
if (cliMsg->type == Release) return; \
|
||||||
} \
|
} \
|
||||||
tDebug("%s conn %p receive release request, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn)); \
|
tDebug("%s conn %p receive release request, refId:%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, conn->refId); \
|
||||||
if (T_REF_VAL_GET(conn) > 1) { \
|
if (T_REF_VAL_GET(conn) > 1) { \
|
||||||
transUnrefCliHandle(conn); \
|
transUnrefCliHandle(conn); \
|
||||||
} \
|
} \
|
||||||
destroyCmsg(pMsg); \
|
destroyCmsg(pMsg); \
|
||||||
cliReleaseUnfinishedMsg(conn); \
|
cliReleaseUnfinishedMsg(conn); \
|
||||||
transQueueClear(&conn->cliMsgs); \
|
transQueueClear(&conn->cliMsgs); \
|
||||||
addConnToPool(((SCliThrd*)conn->hostThrd)->pool, conn); \
|
addConnToPool(((SCliThrd*)conn->hostThrd)->pool, conn); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
|
#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
|
||||||
|
@ -890,6 +890,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) {
|
||||||
if (refId != 0) {
|
if (refId != 0) {
|
||||||
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
|
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
|
||||||
if (exh == NULL) {
|
if (exh == NULL) {
|
||||||
|
tError("failed to get conn, refId: %" PRId64 "", refId);
|
||||||
*ignore = true;
|
*ignore = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue