Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
6393f62f
Commit
6393f62f
authored
Nov 30, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SlapPopen: Wait until timed-out process is killed
parent
8a3beac1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
slapos/grid/utils.py
slapos/grid/utils.py
+6
-2
No files found.
slapos/grid/utils.py
View file @
6393f62f
...
@@ -193,7 +193,9 @@ class SlapPopen(subprocess.Popen):
...
@@ -193,7 +193,9 @@ class SlapPopen(subprocess.Popen):
try
:
try
:
self
.
wait
(
timeout
=
timeout
)
self
.
wait
(
timeout
=
timeout
)
except
subprocess
.
TimeoutExpired
as
e
:
except
subprocess
.
TimeoutExpired
as
e
:
killProcessTree
(
self
.
pid
,
logger
)
for
p
in
killProcessTree
(
self
.
pid
,
logger
):
p
.
wait
(
timeout
=
10
)
# arbitrary timeout, wait until process is killed
self
.
poll
()
# set returncode (and avoid still-running warning)
e
.
output
=
e
.
stdout
=
''
.
join
(
buffers
.
get
(
stdout_fileno
,
()))
e
.
output
=
e
.
stdout
=
''
.
join
(
buffers
.
get
(
stdout_fileno
,
()))
e
.
stderr
=
''
.
join
(
buffers
.
get
(
stderr_fileno
,
()))
e
.
stderr
=
''
.
join
(
buffers
.
get
(
stderr_fileno
,
()))
raise
raise
...
@@ -486,7 +488,7 @@ def killProcessTree(pid, logger):
...
@@ -486,7 +488,7 @@ def killProcessTree(pid, logger):
process
=
psutil
.
Process
(
pid
)
process
=
psutil
.
Process
(
pid
)
process
.
suspend
()
process
.
suspend
()
except
psutil
.
Error
:
except
psutil
.
Error
:
return
return
()
process_list
=
[
process
]
process_list
=
[
process
]
running_process_list
=
process
.
children
(
recursive
=
True
)
running_process_list
=
process
.
children
(
recursive
=
True
)
...
@@ -506,3 +508,5 @@ def killProcessTree(pid, logger):
...
@@ -506,3 +508,5 @@ def killProcessTree(pid, logger):
process
.
kill
()
process
.
kill
()
except
psutil
.
Error
as
e
:
except
psutil
.
Error
as
e
:
logger
.
debug
(
"Process kill: %s"
%
e
)
logger
.
debug
(
"Process kill: %s"
%
e
)
return
process_list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment