Skip to content

Commit 02cfbb9

Browse files
authored
add print on failing termination (#234)
1 parent b6bc69c commit 02cfbb9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

RLTest/redis_std.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,13 @@ def _stopProcess(self, role):
468468
if self.terminateRetries is None:
469469
# ask once, then wait for process to exit
470470
process.terminate()
471-
while True:
472-
if process.poll() is None: # None returns if the processes is not finished yet, retry until redis exits
473-
time.sleep(0.1)
474-
else:
475-
break
471+
termination_start_time = time.time()
472+
while process.poll() is None: # None returns if the processes is not finished yet, retry until redis exits
473+
time.sleep(0.1)
474+
if time.time() - termination_start_time > 30:
475+
# if process is still running after 30 seconds, try reading its output
476+
process_out, process_err = process.communicate()
477+
print(Colors.Bred(f'\t[TERMINATING] out ({process_out}), error ({process_err})'))
476478
else:
477479
# keep asking every few seconds until process has exited, otherwise kill
478480
if self.terminateRetrySecs is None:

0 commit comments

Comments
 (0)