regtest/backends/__init__.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fb1ffd2bf8a74e2cd08ee77f7813dfcf594a59ad
Author: Thomas Freitag <[email protected]>
Date:   Sat Jan 7 11:47:19 2012 +0100

    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.

diff --git a/regtest/backends/__init__.py b/regtest/backends/__init__.py
index 157170d..47985fb 100644
--- a/regtest/backends/__init__.py
+++ b/regtest/backends/__init__.py
@@ -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)
 
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to