Comment 1 for bug 615740

Revision history for this message
Martin Pool (mbp) wrote :

Proposed fix:

=== modified file 'test_on_merge.py'
--- test_on_merge.py 2010-07-28 14:28:57 +0000
+++ test_on_merge.py 2010-08-10 07:53:34 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python -S
 #
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).

 """Tests that get run automatically on a merge."""
@@ -13,7 +13,7 @@
 import psycopg2
 from subprocess import Popen, PIPE, STDOUT
 from signal import SIGKILL, SIGTERM
-from select import select
+import select

 # The TIMEOUT setting (expressed in seconds) affects how long a test will run
 # before it is deemed to be hung, and then appropriately terminated.
@@ -155,7 +155,18 @@
     # stderr for too long.
     open_readers = set([proc.stdout])
     while open_readers:
- rlist, wlist, xlist = select(open_readers, [], [], TIMEOUT)
+ # blocks for a long time and can easily fail with EINTR
+ # <https://bugs.launchpad.net/launchpad/+bug/615740> - catching
+ # it just here is not very useful but is pragmatic
+ while True
+ try:
+ rlist, wlist, xlist = select.select(open_readers, [], [], TIMEOUT)
+ break
+ except select.error, e:
+ if e.errno == errno.EINTR:
+ continue
+ else:
+ raise

         if len(rlist) == 0:
             if proc.poll() is not None: