Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a68a5b73
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a68a5b73
编写于
5月 08, 2023
作者:
H
Hui Li
提交者:
GitHub
5月 08, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21212 from taosdata/fix/TD-24030
fix: fix invalid read
上级
95b228a0
c3e0de0b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
15 deletion
+16
-15
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+15
-14
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+1
-1
未找到文件。
source/libs/transport/src/transCli.c
浏览文件 @
a68a5b73
...
...
@@ -587,12 +587,12 @@ void* destroyConnPool(SCliThrd* pThrd) {
static
SCliConn
*
getConnFromPool
(
SCliThrd
*
pThrd
,
char
*
key
,
bool
*
exceed
)
{
void
*
pool
=
pThrd
->
pool
;
SConnList
*
plist
=
taosHashGet
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
));
SConnList
*
plist
=
taosHashGet
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
)
+
1
);
STrans
*
pTranInst
=
pThrd
->
pTransInst
;
if
(
plist
==
NULL
)
{
SConnList
list
=
{
0
};
taosHashPut
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
),
(
void
*
)
&
list
,
sizeof
(
list
));
plist
=
taosHashGet
(
pool
,
key
,
strlen
(
key
));
taosHashPut
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
)
+
1
,
(
void
*
)
&
list
,
sizeof
(
list
));
plist
=
taosHashGet
(
pool
,
key
,
strlen
(
key
)
+
1
);
SMsgList
*
nList
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgList
));
QUEUE_INIT
(
&
nList
->
msgQ
);
...
...
@@ -627,11 +627,11 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) {
static
SCliConn
*
getConnFromPool2
(
SCliThrd
*
pThrd
,
char
*
key
,
SCliMsg
**
pMsg
)
{
void
*
pool
=
pThrd
->
pool
;
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
SConnList
*
plist
=
taosHashGet
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
));
SConnList
*
plist
=
taosHashGet
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
)
+
1
);
if
(
plist
==
NULL
)
{
SConnList
list
=
{
0
};
taosHashPut
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
),
(
void
*
)
&
list
,
sizeof
(
list
));
plist
=
taosHashGet
(
pool
,
key
,
strlen
(
key
));
taosHashPut
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
)
+
1
,
(
void
*
)
&
list
,
sizeof
(
list
));
plist
=
taosHashGet
(
pool
,
key
,
strlen
(
key
)
+
1
);
SMsgList
*
nList
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgList
));
QUEUE_INIT
(
&
nList
->
msgQ
);
...
...
@@ -717,7 +717,7 @@ static void addConnToPool(void* pool, SCliConn* conn) {
cliDestroyConnMsgs
(
conn
,
false
);
if
(
conn
->
list
==
NULL
)
{
conn
->
list
=
taosHashGet
((
SHashObj
*
)
pool
,
conn
->
ip
,
strlen
(
conn
->
ip
));
conn
->
list
=
taosHashGet
((
SHashObj
*
)
pool
,
conn
->
ip
,
strlen
(
conn
->
ip
)
+
1
);
}
SConnList
*
pList
=
conn
->
list
;
...
...
@@ -822,7 +822,8 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
return
;
}
if
(
nread
<
0
)
{
tWarn
(
"%s conn %p read error:%s, ref:%d"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
uv_err_name
(
nread
),
T_REF_VAL_GET
(
conn
));
tDebug
(
"%s conn %p read error:%s, ref:%d"
,
CONN_GET_INST_LABEL
(
conn
),
conn
,
uv_err_name
(
nread
),
T_REF_VAL_GET
(
conn
));
conn
->
broken
=
true
;
cliHandleExcept
(
conn
);
}
...
...
@@ -875,8 +876,8 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
connList
->
list
->
numOfConn
--
;
connList
->
size
--
;
}
else
{
SConnList
*
connList
=
taosHashGet
((
SHashObj
*
)
pThrd
->
pool
,
conn
->
ip
,
strlen
(
conn
->
ip
));
connList
->
list
->
numOfConn
--
;
SConnList
*
connList
=
taosHashGet
((
SHashObj
*
)
pThrd
->
pool
,
conn
->
ip
,
strlen
(
conn
->
ip
)
+
1
);
if
(
connList
!=
NULL
)
connList
->
list
->
numOfConn
--
;
}
conn
->
list
=
NULL
;
pThrd
->
newConnCount
--
;
...
...
@@ -1269,7 +1270,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
if
(
pMsg
!=
NULL
&&
REQUEST_NO_RESP
(
&
pMsg
->
msg
)
&&
(
pTransInst
->
failFastFp
!=
NULL
&&
pTransInst
->
failFastFp
(
pMsg
->
msg
.
msgType
)))
{
SFailFastItem
*
item
=
taosHashGet
(
pThrd
->
failFastCache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
));
SFailFastItem
*
item
=
taosHashGet
(
pThrd
->
failFastCache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
)
+
1
);
int64_t
cTimestamp
=
taosGetTimestampMs
();
if
(
item
!=
NULL
)
{
int32_t
elapse
=
cTimestamp
-
item
->
timestamp
;
...
...
@@ -1281,7 +1282,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
}
}
else
{
SFailFastItem
item
=
{.
count
=
1
,
.
timestamp
=
cTimestamp
};
taosHashPut
(
pThrd
->
failFastCache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
),
&
item
,
sizeof
(
SFailFastItem
));
taosHashPut
(
pThrd
->
failFastCache
,
pConn
->
ip
,
strlen
(
pConn
->
ip
)
+
1
,
&
item
,
sizeof
(
SFailFastItem
));
}
}
}
else
{
...
...
@@ -1459,7 +1460,7 @@ FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) {
}
static
FORCE_INLINE
uint32_t
cliGetIpFromFqdnCache
(
SHashObj
*
cache
,
char
*
fqdn
)
{
uint32_t
addr
=
0
;
uint32_t
*
v
=
taosHashGet
(
cache
,
fqdn
,
strlen
(
fqdn
));
uint32_t
*
v
=
taosHashGet
(
cache
,
fqdn
,
strlen
(
fqdn
)
+
1
);
if
(
v
==
NULL
)
{
addr
=
taosGetIpv4FromFqdn
(
fqdn
);
if
(
addr
==
0xffffffff
)
{
...
...
@@ -1468,7 +1469,7 @@ static FORCE_INLINE uint32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn)
return
addr
;
}
taosHashPut
(
cache
,
fqdn
,
strlen
(
fqdn
),
&
addr
,
sizeof
(
addr
));
taosHashPut
(
cache
,
fqdn
,
strlen
(
fqdn
)
+
1
,
&
addr
,
sizeof
(
addr
));
}
else
{
addr
=
*
v
;
}
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
a68a5b73
...
...
@@ -314,7 +314,7 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
return
;
}
t
Warn
(
"%s conn %p read error:%s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
nread
));
t
Debug
(
"%s conn %p read error:%s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
nread
));
if
(
nread
<
0
)
{
conn
->
broken
=
true
;
if
(
conn
->
status
==
ConnAcquire
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录