]> granicus.if.org Git - python/commitdiff
Issue #20505: Add debug info to analyze sporaric failures of
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 10 Feb 2014 10:47:50 +0000 (11:47 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 10 Feb 2014 10:47:50 +0000 (11:47 +0100)
test_timeout_rounding() on Windows XP buildbots.

Lib/asyncio/base_events.py
Lib/test/test_asyncio/test_events.py

index 558406c272f9010017adc87614083eed2ddac1f3..4207a7e9f1eb2e7ad0b160dab791f84db9646dc1 100644 (file)
@@ -633,7 +633,13 @@ class BaseEventLoop(events.AbstractEventLoop):
             else:
                 logger.log(level, 'poll took %.3f seconds', t1-t0)
         else:
+            t0 = self.time()
             event_list = self._selector.select(timeout)
+            dt = self.time() - t0
+            if not event_list and timeout and dt < timeout:
+                print("asyncio: selector.select(%.3f ms) took %.3f ms"
+                      % (timeout*1e3, dt*1e3),
+                      file=sys.__stderr__, flush=True)
         self._process_events(event_list)
 
         # Handle 'later' callbacks that are ready.
index 4fb4b25481b2acedb754d926342e8b97d3a61948..e6a1c97955fcc6906955c53a60acfc69c4704f59 100644 (file)
@@ -1182,7 +1182,10 @@ class EventLoopTestsMixin:
         # may sleep at little bit less than timeout depending on the resolution
         # of the clock used by the kernel. Tolerate 2 useless calls on these
         # platforms.
-        self.assertLessEqual(self.loop._run_once_counter, 8)
+        self.assertLessEqual(self.loop._run_once_counter, 8,
+            {'time_info': time.get_clock_info('time'),
+             'monotonic_info': time.get_clock_info('monotonic'),
+             'selector': self.loop._selector.__class__.__name__})
 
 
 class SubprocessTestsMixin: