[Twisted-Python] LoopingCall.withCount countCallable called with 0
Dario Vinella
d.vinella at gmail.com
Tue Mar 24 03:49:46 MDT 2015
Hi all,
I found an odd behavior using a LoopingCall.withCount with a very small
interval (0.02 sec): sometimes the countCallable is called with 0 as
argument and it looks like the now - _realLastTime is smaller than the
looping interval.
Here you can find the very simple code I use to reproduce the "anomaly",
with a main loopingCall and another one that prints its internals
https://gist.github.com/dvinella/31d94f9dd0e47586658d
and here an extract of the logs it produces
https://gist.github.com/dvinella/8cfdce0b9f5fdda7b375
The doc for the withCount states that the argument should be normally 1,
higher if the reactor blocks for some reason, but it doesn't say anything
about 0.
The beahavior is quite misleading since the loop seems to anticipate the
interval timeout, saying "I've been called, but I should have not been
called"
I must add that the anomaly doesn't appear right at the start, but after
tens of seconds, mostly when the system is under medium/heavy load.
So is it only a documentation issue for an exceptional case, due to timers
imprecision, that should be handled at higher levels, or is it a real issue?
dario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20150324/b5384e20/attachment.html>
More information about the Twisted-Python
mailing list