← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~frankban/launchpad/bug-1014907 into lp:launchpad

 

Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-1014907 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1014907 in Launchpad itself: "lp.services.webapp.tests.test_sigusr2.SIGUSR2TestCase.test_sigusr2 fails intermittently/rarely in parallel tests"
  https://bugs.launchpad.net/launchpad/+bug/1014907

For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-1014907/+merge/110987

= Summary =

SIGUSR2TestCase.test_sigusr2 fails intermittently/rarely in parallel tests.
This is another timeout issue we are encountering in parallel tests.

== Proposed fix ==

Replace timeout with retries and increase the overall time before raising a
failure.

== Pre-implementation notes ==

I've reproduced the bug using stress, e.g.::

    $ stress --cpu 8 --io 8 --vm 4 --vm-bytes 1000M
    $ w
    09:47:01 up 19:29,  3 users,  load average: 20.82, 20.52, 18.39
    
== Implementation details ==

See proposed fix.

== Tests ==

$ bin/test -cvvt lp.services.webapp.tests.test_sigusr2.SIGUSR2TestCase

NO QA

Linting changed files:
  lib/lp/services/webapp/tests/test_sigusr2.py

-- 
https://code.launchpad.net/~frankban/launchpad/bug-1014907/+merge/110987
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~frankban/launchpad/bug-1014907 into lp:launchpad.
=== modified file 'lib/lp/services/webapp/tests/test_sigusr2.py'
--- lib/lp/services/webapp/tests/test_sigusr2.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/webapp/tests/test_sigusr2.py	2012-06-19 09:54:26 +0000
@@ -31,7 +31,6 @@
             sys.executable,
             os.path.join(os.path.dirname(__file__), 'sigusr2.py'),
             main_log]
-
         proc = subprocess.Popen(
             helper_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         try:
@@ -69,13 +68,12 @@
         self.assertEqual(open(main_log, 'r').read(), 'Message 3\n')
 
     def sync(self, step):
-        timeout = 10
+        retries = 200
         event_filename = os.path.join(self.logdir, step)
-        start_time = time.time()
-        while time.time() < start_time + timeout:
+        for i in range(retries):
             if os.path.exists(event_filename):
                 os.unlink(event_filename)
                 return
-        self.fail("sync step %s didn't happen in %d seconds." % (
-            step, timeout))
-
+            time.sleep(0.3)
+        self.fail("sync step %s didn't happen after %d retries." % (
+            step, retries))


Follow ups