Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7dea2e99
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7dea2e99
编写于
11月 10, 2022
作者:
D
dapan1121
提交者:
GitHub
11月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17973 from taosdata/fix/TD-20273
fix: free unfinished ahandle when cli quit
上级
79a8ebb3
1ed33314
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
43 addition
and
14 deletion
+43
-14
include/libs/qcom/query.h
include/libs/qcom/query.h
+2
-0
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+4
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-1
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+6
-0
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+3
-0
source/libs/scheduler/src/schTask.c
source/libs/scheduler/src/schTask.c
+6
-2
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+1
-0
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+18
-11
未找到文件。
include/libs/qcom/query.h
浏览文件 @
7dea2e99
...
...
@@ -204,6 +204,8 @@ int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
);
void
destroyAhandle
(
void
*
ahandle
);
int32_t
asyncSendMsgToServerExt
(
void
*
pTransporter
,
SEpSet
*
epSet
,
int64_t
*
pTransporterId
,
SMsgSendInfo
*
pInfo
,
bool
persistHandle
,
void
*
ctx
);
...
...
include/libs/transport/trpc.h
浏览文件 @
7dea2e99
...
...
@@ -72,6 +72,7 @@ typedef struct SRpcMsg {
typedef
void
(
*
RpcCfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
epset
);
typedef
bool
(
*
RpcRfp
)(
int32_t
code
,
tmsg_t
msgType
);
typedef
bool
(
*
RpcTfp
)(
int32_t
code
,
tmsg_t
msgType
);
typedef
void
(
*
RpcDfp
)(
void
*
ahandle
);
typedef
struct
SRpcInit
{
char
localFqdn
[
TSDB_FQDN_LEN
];
...
...
@@ -97,6 +98,9 @@ typedef struct SRpcInit {
// set up timeout for particular msg
RpcTfp
tfp
;
// destroy client ahandle;
RpcDfp
dfp
;
void
*
parent
;
}
SRpcInit
;
...
...
source/client/src/clientEnv.c
浏览文件 @
7dea2e99
...
...
@@ -140,12 +140,13 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
rpcInit
.
numOfThreads
=
numOfThread
;
rpcInit
.
cfp
=
processMsgFromServer
;
rpcInit
.
rfp
=
clientRpcRfp
;
// rpcInit.tfp = clientRpcTfp;
rpcInit
.
sessions
=
1024
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
(
char
*
)
user
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
compressSize
=
tsCompressMsgSize
;
rpcInit
.
dfp
=
destroyAhandle
;
void
*
pDnodeConn
=
rpcOpen
(
&
rpcInit
);
if
(
pDnodeConn
==
NULL
)
{
tscError
(
"failed to init connection to server"
);
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
7dea2e99
...
...
@@ -146,6 +146,12 @@ void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
}
taosMemoryFreeClear
(
pMsgBody
);
}
void
destroyAhandle
(
void
*
ahandle
)
{
SMsgSendInfo
*
pSendInfo
=
ahandle
;
if
(
pSendInfo
==
NULL
)
return
;
destroySendMsgInfo
(
pSendInfo
);
}
int32_t
asyncSendMsgToServerExt
(
void
*
pTransporter
,
SEpSet
*
epSet
,
int64_t
*
pTransporterId
,
SMsgSendInfo
*
pInfo
,
bool
persistHandle
,
void
*
rpcCtx
)
{
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
7dea2e99
...
...
@@ -425,6 +425,7 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
_return:
taosMemoryFreeClear
(
pMsg
->
pData
);
taosMemoryFreeClear
(
pMsg
->
pEpSet
);
qDebug
(
"end to handle rsp msg, type:%s, handle:%p, code:%s"
,
TMSG_INFO
(
pMsg
->
msgType
),
pMsg
->
handle
,
tstrerror
(
rspCode
));
...
...
@@ -438,6 +439,7 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) {
code
);
if
(
pMsg
)
{
taosMemoryFree
(
pMsg
->
pData
);
taosMemoryFree
(
pMsg
->
pEpSet
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -492,6 +494,7 @@ _return:
tFreeSSchedulerHbRsp
(
&
rsp
);
taosMemoryFree
(
pMsg
->
pData
);
taosMemoryFree
(
pMsg
->
pEpSet
);
SCH_RET
(
code
);
}
...
...
source/libs/scheduler/src/schTask.c
浏览文件 @
7dea2e99
...
...
@@ -439,6 +439,8 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32
code
=
schDoTaskRedirect
(
pJob
,
pTask
,
pData
,
rspCode
);
taosMemoryFree
(
pData
->
pData
);
taosMemoryFree
(
pData
->
pEpSet
);
pData
->
pData
=
NULL
;
pData
->
pEpSet
=
NULL
;
SCH_RET
(
code
);
...
...
@@ -446,6 +448,8 @@ _return:
taosMemoryFree
(
pData
->
pData
);
taosMemoryFree
(
pData
->
pEpSet
);
pData
->
pData
=
NULL
;
pData
->
pEpSet
=
NULL
;
SCH_RET
(
schProcessOnTaskFailure
(
pJob
,
pTask
,
code
));
}
...
...
@@ -942,7 +946,7 @@ int32_t schLaunchLocalTask(SSchJob *pJob, SSchTask *pTask) {
}
SCH_ERR_JRET
(
qWorkerProcessLocalQuery
(
schMgmt
.
queryMgmt
,
schMgmt
.
sId
,
pJob
->
queryId
,
pTask
->
taskId
,
pJob
->
refId
,
pTask
->
execId
,
&
qwMsg
,
explainRes
));
pTask
->
execId
,
&
qwMsg
,
explainRes
));
if
(
SCH_IS_EXPLAIN_JOB
(
pJob
))
{
SCH_ERR_RET
(
schHandleExplainRes
(
explainRes
));
...
...
@@ -1115,7 +1119,7 @@ int32_t schExecLocalFetch(SSchJob *pJob, SSchTask *pTask) {
}
SCH_ERR_JRET
(
qWorkerProcessLocalFetch
(
schMgmt
.
queryMgmt
,
schMgmt
.
sId
,
pJob
->
queryId
,
pTask
->
taskId
,
pJob
->
refId
,
pTask
->
execId
,
&
pRsp
,
explainRes
));
pTask
->
execId
,
&
pRsp
,
explainRes
));
if
(
SCH_IS_EXPLAIN_JOB
(
pJob
))
{
SCH_ERR_RET
(
schHandleExplainRes
(
explainRes
));
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
7dea2e99
...
...
@@ -53,6 +53,7 @@ typedef struct {
void
(
*
cfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
bool
(
*
retry
)(
int32_t
code
,
tmsg_t
msgType
);
bool
(
*
startTimer
)(
int32_t
code
,
tmsg_t
msgType
);
void
(
*
destroyFp
)(
void
*
ahandle
);
int
index
;
void
*
parent
;
...
...
source/libs/transport/src/trans.c
浏览文件 @
7dea2e99
...
...
@@ -53,6 +53,7 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
cfp
=
pInit
->
cfp
;
pRpc
->
retry
=
pInit
->
rfp
;
pRpc
->
startTimer
=
pInit
->
tfp
;
pRpc
->
destroyFp
=
pInit
->
dfp
;
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
7dea2e99
...
...
@@ -143,6 +143,7 @@ static FORCE_INLINE void cliUpdateFqdnCache(SHashObj* cache, char* fqdn);
static
void
cliHandleResp
(
SCliConn
*
conn
);
// handle except about conn
static
void
cliHandleExcept
(
SCliConn
*
conn
);
static
void
cliReleaseUnfinishedMsg
(
SCliConn
*
conn
);
// handle req from app
static
void
cliHandleReq
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
);
...
...
@@ -163,17 +164,6 @@ static void destroyThrdObj(SCliThrd* pThrd);
static
void
cliWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
);
static
void
cliReleaseUnfinishedMsg
(
SCliConn
*
conn
)
{
for
(
int
i
=
0
;
i
<
transQueueSize
(
&
conn
->
cliMsgs
);
i
++
)
{
SCliMsg
*
msg
=
transQueueGet
(
&
conn
->
cliMsgs
,
i
);
if
(
msg
!=
NULL
&&
msg
->
ctx
!=
NULL
&&
msg
->
ctx
->
ahandle
!=
(
void
*
)
0x9527
)
{
if
(
conn
->
ctx
.
freeFunc
!=
NULL
&&
msg
->
ctx
->
ahandle
!=
NULL
)
{
conn
->
ctx
.
freeFunc
(
msg
->
ctx
->
ahandle
);
}
}
destroyCmsg
(
msg
);
}
}
#define CLI_RELEASE_UV(loop) \
do { \
uv_walk(loop, cliWalkCb, NULL); \
...
...
@@ -266,6 +256,23 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
static
void
*
cliWorkThread
(
void
*
arg
);
static
void
cliReleaseUnfinishedMsg
(
SCliConn
*
conn
)
{
SCliThrd
*
pThrd
=
conn
->
hostThrd
;
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
for
(
int
i
=
0
;
i
<
transQueueSize
(
&
conn
->
cliMsgs
);
i
++
)
{
SCliMsg
*
msg
=
transQueueGet
(
&
conn
->
cliMsgs
,
i
);
if
(
msg
!=
NULL
&&
msg
->
ctx
!=
NULL
&&
msg
->
ctx
->
ahandle
!=
(
void
*
)
0x9527
)
{
if
(
conn
->
ctx
.
freeFunc
!=
NULL
&&
msg
->
ctx
->
ahandle
!=
NULL
)
{
conn
->
ctx
.
freeFunc
(
msg
->
ctx
->
ahandle
);
}
else
if
(
msg
->
ctx
->
ahandle
!=
NULL
&&
pTransInst
->
destroyFp
!=
NULL
)
{
tDebug
(
"%s conn %p destroy unfinished ahandle %p"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
msg
->
ctx
->
ahandle
);
pTransInst
->
destroyFp
(
msg
->
ctx
->
ahandle
);
}
}
destroyCmsg
(
msg
);
}
}
bool
cliMaySendCachedMsg
(
SCliConn
*
conn
)
{
if
(
!
transQueueEmpty
(
&
conn
->
cliMsgs
))
{
SCliMsg
*
pCliMsg
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录