test_on_merge.py doesn't handle eintr

Bug #615740 reported by Martin Pool
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Martin Pool

Bug Description

If you resize a window while 'make check' is running, you get

 test_scriptnotfound_timing (canonical.launchpad.scripts.tests.test_scriptmonitor.CheckScriptTestCase)
 canonical.launchpad.tests.test_sampledata.SampleDataTestCase.test_testSampledataTraceback (most recent call last):
  File "./test_on_merge.py", line 203, in <module>
    sys.exit(main())
  File "./test_on_merge.py", line 158, in main
    rlist, wlist, xlist = select(open_readers, [], [], TIMEOUT)
select.error: (4, 'Interrupted system call')
make: *** [check] Error 1
make check 151.96s user 41.28s system 33% cpu 9:42.08 total

sigh

Martin Pool (mbp)
summary: - test_on_merge.py doesn't handle eintry
+ test_on_merge.py doesn't handle eintr
Martin Pool (mbp)
affects: launchpad → launchpad-foundations
Changed in launchpad-foundations:
assignee: nobody → Martin Pool (mbp)
importance: Undecided → Medium
status: New → In Progress
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:

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

Probably not easily testable, but I can manually reproduce it by wiggling the window after the message about setting up an xvfb shows up. (Perhaps something connected to that changes the signal mask, though it seems a bit unlikely.)

Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in launchpad-foundations:
milestone: none → 10.10
tags: added: qa-needstesting
Changed in launchpad-foundations:
status: In Progress → Fix Committed
Gary Poster (gary)
tags: added: qa-untestable
removed: qa-needstesting
Revision history for this message
Martin Pool (mbp) wrote :

I manually tested resizing a window running 'test_on_merge.py' from devel, and it didn't crash, so I think this is fixed.

tags: added: qa-ok
removed: qa-untestable
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.