Commit c2378609 authored by Thomas Freitag's avatar Thomas Freitag Committed by Carlos Garcia Campos
Browse files

regtest: read stderr output before calling wait to fix a possible deadlock

In the way the scripts starts it subprocesses, stderr becomes buffered
for the subprocesses. And unforunately, when the buffer limit is
reached, the subprocess suspends it work until it can print again on
stderr. That's why the python script runs into a deadlock when the
subprocess produces a lot of error messages. A small rearrange of the
commands, first read the stderr output and then wait that the subprocess
ends, will remove this deadlock.
parent da6bfacb
......@@ -173,11 +173,11 @@ class Backend:
return True
def _check_exit_status(self, p, out_path):
status = p.wait()
stderr = p.stderr.read()
self.__create_stderr_file(stderr, out_path)
status = p.wait()
if not os.WIFEXITED(status):
open(out_path + '.crashed', 'w').close()
return False
......@@ -188,11 +188,11 @@ class Backend:
return True
def _check_exit_status2(self, p1, p2, out_path):
p1_stderr = p1.stderr.read()
status1 = p1.wait()
p2_stderr = p2.stderr.read()
status2 = p2.wait()
p1_stderr = p1.stderr.read()
p2_stderr = p2.stderr.read()
if p1_stderr or p2_stderr:
self.__create_stderr_file(p1_stderr + p2_stderr, out_path)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment