Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a53aafee
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看板
提交
a53aafee
编写于
8月 01, 2020
作者:
S
Steven Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Crash_gen tool is now tracking TDengine service exit status
上级
c9780754
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
10 deletion
+33
-10
tests/pytest/crash_gen.py
tests/pytest/crash_gen.py
+33
-10
未找到文件。
tests/pytest/crash_gen.py
浏览文件 @
a53aafee
...
@@ -2294,6 +2294,12 @@ class ServiceManagerThread:
...
@@ -2294,6 +2294,12 @@ class ServiceManagerThread:
self
.
_thread
.
daemon
=
True
# thread dies with the program
self
.
_thread
.
daemon
=
True
# thread dies with the program
self
.
_thread
.
start
()
self
.
_thread
.
start
()
self
.
_thread2
=
threading
.
Thread
(
target
=
self
.
svcErrorReader
,
args
=
(
self
.
_tdeSubProcess
.
getStdErr
(),
self
.
_ipcQueue
))
self
.
_thread2
.
daemon
=
True
# thread dies with the program
self
.
_thread2
.
start
()
# wait for service to start
# wait for service to start
for
i
in
range
(
0
,
10
):
for
i
in
range
(
0
,
10
):
time
.
sleep
(
1.0
)
time
.
sleep
(
1.0
)
...
@@ -2322,12 +2328,12 @@ class ServiceManagerThread:
...
@@ -2322,12 +2328,12 @@ class ServiceManagerThread:
raise
RuntimeError
(
"sub process object missing"
)
raise
RuntimeError
(
"sub process object missing"
)
self
.
_status
=
MainExec
.
STATUS_STOPPING
self
.
_status
=
MainExec
.
STATUS_STOPPING
self
.
_tdeSubProcess
.
stop
()
retCode
=
self
.
_tdeSubProcess
.
stop
()
print
(
"Attempted to stop sub process, got return code: {}"
.
format
(
retCode
))
if
self
.
_tdeSubProcess
.
isRunning
():
# still running
if
self
.
_tdeSubProcess
.
isRunning
():
# still running
print
(
print
(
"FAILED to stop sub process, it is still running... pid = {}"
.
format
(
"FAILED to stop sub process, it is still running... pid = {}"
.
format
(
self
.
_tdeSubProcess
.
getPid
()))
self
.
_tdeSubProcess
.
pid
))
else
:
else
:
self
.
_tdeSubProcess
=
None
# not running any more
self
.
_tdeSubProcess
=
None
# not running any more
self
.
join
()
# stop the thread, change the status, etc.
self
.
join
()
# stop the thread, change the status, etc.
...
@@ -2343,6 +2349,9 @@ class ServiceManagerThread:
...
@@ -2343,6 +2349,9 @@ class ServiceManagerThread:
self
.
_thread
.
join
()
self
.
_thread
.
join
()
self
.
_thread
=
None
self
.
_thread
=
None
self
.
_status
=
MainExec
.
STATUS_STOPPED
self
.
_status
=
MainExec
.
STATUS_STOPPED
# STD ERR thread
self
.
_thread2
.
join
()
self
.
_thread2
=
None
else
:
else
:
print
(
"Joining empty thread, doing nothing"
)
print
(
"Joining empty thread, doing nothing"
)
...
@@ -2423,6 +2432,10 @@ class ServiceManagerThread:
...
@@ -2423,6 +2432,10 @@ class ServiceManagerThread:
print
(
"
\n
No more output from IO thread managing TDengine service"
)
print
(
"
\n
No more output from IO thread managing TDengine service"
)
out
.
close
()
out
.
close
()
def
svcErrorReader
(
self
,
err
:
IO
,
queue
):
for
line
in
iter
(
err
.
readline
,
b
''
):
print
(
"
\n
TD Svc STDERR: {}"
.
format
(
line
))
class
TdeSubProcess
:
class
TdeSubProcess
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -2431,9 +2444,15 @@ class TdeSubProcess:
...
@@ -2431,9 +2444,15 @@ class TdeSubProcess:
def
getStdOut
(
self
):
def
getStdOut
(
self
):
return
self
.
subProcess
.
stdout
return
self
.
subProcess
.
stdout
def
getStdErr
(
self
):
return
self
.
subProcess
.
stderr
def
isRunning
(
self
):
def
isRunning
(
self
):
return
self
.
subProcess
is
not
None
return
self
.
subProcess
is
not
None
def
getPid
(
self
):
return
self
.
subProcess
.
pid
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
...
@@ -2469,18 +2488,18 @@ class TdeSubProcess:
...
@@ -2469,18 +2488,18 @@ class TdeSubProcess:
os
.
rename
(
logPath
,
logPathSaved
)
os
.
rename
(
logPath
,
logPathSaved
)
# os.mkdir(logPath) # recreate, no need actually, TDengine will auto-create with proper perms
# os.mkdir(logPath) # recreate, no need actually, TDengine will auto-create with proper perms
svcCmd
=
[
taosdPath
,
'-c'
,
cfgPath
]
svcCmd
=
[
taosdPath
,
'-c'
,
cfgPath
]
svcCmdSingle
=
"{} -c {}"
.
format
(
taosdPath
,
cfgPath
)
#
svcCmdSingle = "{} -c {}".format(taosdPath, cfgPath)
# svcCmd = ['vmstat', '1']
# svcCmd = ['vmstat', '1']
if
self
.
subProcess
:
# already there
if
self
.
subProcess
:
# already there
raise
RuntimeError
(
"Corrupt process state"
)
raise
RuntimeError
(
"Corrupt process state"
)
# print("Starting service: {}".format(svcCmd))
# print("Starting service: {}".format(svcCmd))
self
.
subProcess
=
subprocess
.
Popen
(
self
.
subProcess
=
subprocess
.
Popen
(
#
svcCmd, shell=False,
svcCmd
,
shell
=
False
,
svcCmdSingle
,
shell
=
True
,
# capture core dump?
#
svcCmdSingle, shell=True, # capture core dump?
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
# bufsize=1, # not supported in binary mode
# bufsize=1, # not supported in binary mode
close_fds
=
ON_POSIX
close_fds
=
ON_POSIX
)
# had text=True, which interferred with reading EOF
)
# had text=True, which interferred with reading EOF
...
@@ -2488,9 +2507,9 @@ class TdeSubProcess:
...
@@ -2488,9 +2507,9 @@ class TdeSubProcess:
def
stop
(
self
):
def
stop
(
self
):
if
not
self
.
subProcess
:
if
not
self
.
subProcess
:
print
(
"Sub process already stopped"
)
print
(
"Sub process already stopped"
)
return
return
-
1
retCode
=
self
.
subProcess
.
poll
()
retCode
=
self
.
subProcess
.
poll
()
# contains real sub process return code
if
retCode
:
# valid return code, process ended
if
retCode
:
# valid return code, process ended
self
.
subProcess
=
None
self
.
subProcess
=
None
else
:
# process still alive, let's interrupt it
else
:
# process still alive, let's interrupt it
...
@@ -2501,11 +2520,15 @@ class TdeSubProcess:
...
@@ -2501,11 +2520,15 @@ class TdeSubProcess:
self
.
subProcess
.
send_signal
(
signal
.
SIGINT
)
self
.
subProcess
.
send_signal
(
signal
.
SIGINT
)
try
:
try
:
self
.
subProcess
.
wait
(
10
)
self
.
subProcess
.
wait
(
10
)
retCode
=
self
.
subProcess
.
returncode
except
subprocess
.
TimeoutExpired
as
err
:
except
subprocess
.
TimeoutExpired
as
err
:
print
(
"Time out waiting for TDengine service process to exit"
)
print
(
"Time out waiting for TDengine service process to exit"
)
retCode
=
-
3
else
:
else
:
print
(
"TDengine service process terminated successfully from SIG_INT"
)
print
(
"TDengine service process terminated successfully from SIG_INT"
)
retCode
=
-
4
self
.
subProcess
=
None
self
.
subProcess
=
None
return
retCode
class
ThreadStacks
:
# stack info for all threads
class
ThreadStacks
:
# stack info for all threads
def
__init__
(
self
):
def
__init__
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录