Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b259777
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看板
提交
6b259777
编写于
1月 17, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: move crash report to shell
上级
59e25c01
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
52 deletion
+51
-52
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+18
-48
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-1
tools/shell/inc/shellInt.h
tools/shell/inc/shellInt.h
+1
-0
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+1
-3
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+30
-0
未找到文件。
source/client/src/clientEnv.c
浏览文件 @
6b259777
...
...
@@ -388,45 +388,6 @@ void destroyRequest(SRequestObj *pRequest) {
removeRequest
(
pRequest
->
self
);
}
void
taosClientCrash
(
int
signum
,
void
*
sigInfo
,
void
*
context
)
{
taosIgnSignal
(
SIGTERM
);
taosIgnSignal
(
SIGHUP
);
taosIgnSignal
(
SIGINT
);
taosIgnSignal
(
SIGBREAK
);
#if !defined(WINDOWS)
taosIgnSignal
(
SIGBUS
);
#endif
taosIgnSignal
(
SIGABRT
);
taosIgnSignal
(
SIGFPE
);
taosIgnSignal
(
SIGSEGV
);
char
*
pMsg
=
NULL
;
const
char
*
flags
=
"UTL FATAL "
;
ELogLevel
level
=
DEBUG_FATAL
;
int32_t
dflag
=
255
;
int64_t
msgLen
=
-
1
;
if
(
tsEnableCrashReport
)
{
if
(
taosGenCrashJsonMsg
(
signum
,
&
pMsg
,
lastClusterId
,
appInfo
.
startTime
))
{
taosPrintLog
(
flags
,
level
,
dflag
,
"failed to generate crash json msg"
);
goto
_return
;
}
else
{
msgLen
=
strlen
(
pMsg
);
}
}
_return:
taosLogCrashInfo
(
"taos"
,
pMsg
,
msgLen
,
signum
,
sigInfo
);
#ifdef _TD_DARWIN_64
exit
(
signum
);
#elif defined(WINDOWS)
exit
(
signum
);
#endif
}
void
crashReportThreadFuncUnexpectedStopped
(
void
)
{
atomic_store_32
(
&
clientStop
,
-
1
);
}
static
void
*
tscCrashReportThreadFp
(
void
*
param
)
{
...
...
@@ -523,15 +484,26 @@ void tscStopCrashReport() {
}
}
static
void
tscSetSignalHandle
()
{
#if !defined(WINDOWS)
taosSetSignal
(
SIGBUS
,
taosClientCrash
);
#endif
taosSetSignal
(
SIGABRT
,
taosClientCrash
);
taosSetSignal
(
SIGFPE
,
taosClientCrash
);
taosSetSignal
(
SIGSEGV
,
taosClientCrash
);
void
tscWriteCrashInfo
(
int
signum
,
void
*
sigInfo
,
void
*
context
)
{
char
*
pMsg
=
NULL
;
const
char
*
flags
=
"UTL FATAL "
;
ELogLevel
level
=
DEBUG_FATAL
;
int32_t
dflag
=
255
;
int64_t
msgLen
=
-
1
;
if
(
tsEnableCrashReport
)
{
if
(
taosGenCrashJsonMsg
(
signum
,
&
pMsg
,
lastClusterId
,
appInfo
.
startTime
))
{
taosPrintLog
(
flags
,
level
,
dflag
,
"failed to generate crash json msg"
);
}
else
{
msgLen
=
strlen
(
pMsg
);
}
}
taosLogCrashInfo
(
"taos"
,
pMsg
,
msgLen
,
signum
,
sigInfo
);
}
void
taos_init_imp
(
void
)
{
// In the APIs of other program language, taos_cleanup is not available yet.
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
...
...
@@ -555,8 +527,6 @@ void taos_init_imp(void) {
return
;
}
tscSetSignalHandle
();
initQueryModuleMsgHandle
();
if
(
taosConvInit
()
!=
0
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
6b259777
...
...
@@ -1253,7 +1253,7 @@ STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __t
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
pTscObj
->
pAppInfo
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
const
char
*
errorMsg
=
...
...
tools/shell/inc/shellInt.h
浏览文件 @
6b259777
...
...
@@ -147,5 +147,6 @@ void shellRunSingleCommandWebsocketImp(char *command);
// shellMain.c
extern
SShellObj
shell
;
extern
void
tscWriteCrashInfo
(
int
signum
,
void
*
sigInfo
,
void
*
context
);
#endif
/*_TD_SHELL_INT_H_*/
tools/shell/src/shellEngine.c
浏览文件 @
6b259777
...
...
@@ -1136,10 +1136,8 @@ int32_t shellExecute() {
taosSetSignal
(
SIGTERM
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGHUP
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGABRT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGINT
,
shellQueryInterruptHandler
);
#ifdef WEBSOCKET
if
(
!
shell
.
args
.
restful
&&
!
shell
.
args
.
cloud
)
{
#endif
...
...
tools/shell/src/shellMain.c
浏览文件 @
6b259777
...
...
@@ -19,6 +19,29 @@
SShellObj
shell
=
{
0
};
void
shellCrashHandler
(
int
signum
,
void
*
sigInfo
,
void
*
context
)
{
taosIgnSignal
(
SIGTERM
);
taosIgnSignal
(
SIGHUP
);
taosIgnSignal
(
SIGINT
);
taosIgnSignal
(
SIGBREAK
);
#if !defined(WINDOWS)
taosIgnSignal
(
SIGBUS
);
#endif
taosIgnSignal
(
SIGABRT
);
taosIgnSignal
(
SIGFPE
);
taosIgnSignal
(
SIGSEGV
);
tscWriteCrashInfo
(
signum
,
sigInfo
,
context
);
#ifdef _TD_DARWIN_64
exit
(
signum
);
#elif defined(WINDOWS)
exit
(
signum
);
#endif
}
int
main
(
int
argc
,
char
*
argv
[])
{
shell
.
exit
=
false
;
#ifdef WEBSOCKET
...
...
@@ -26,6 +49,13 @@ int main(int argc, char *argv[]) {
shell
.
args
.
cloud
=
true
;
#endif
#if !defined(WINDOWS)
taosSetSignal
(
SIGBUS
,
shellCrashHandler
);
#endif
taosSetSignal
(
SIGABRT
,
shellCrashHandler
);
taosSetSignal
(
SIGFPE
,
shellCrashHandler
);
taosSetSignal
(
SIGSEGV
,
shellCrashHandler
);
if
(
shellCheckIntSize
()
!=
0
)
{
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录