
The backoff timer has a few issues that can cause it to get stuck in an infinite loop and never time out. 1. The random.gauss() function used to generate random jitter can return negative values, so when it does, it makes the elapsed time self._error_time go "backward." 2. The random jitter is used as a multiplier for the self._interval, so self._interval can deviate far away from the mean over time and walk to zero, causing self._interval to be 0, which will prevent the timer from making progress from that point on because idle will always evaluate to zero and the elapsed time won't increase. 3. The evaluated interval doesn't have a lower bound, so over time it can get extremely small if jitter (the mean) < 0.5. This adds a min_interval keyword argument to the BackOffLoopingCall start() function that defaults to 0.001s and uses it to lower bound the interval calculations. We'll also take the absolute value of the return from random.gauss() to prevent elapsed time going backward, and we'll calculate the running self._interval separately to make it track the desired growth rate of the backoff and not let it drift with the random.gauss() values. Closes-Bug: #1686159 Change-Id: Id17668a34d5cedbe870c9056350a7e9c7196faa7
Team and repository tags
oslo.service -- Library for running OpenStack services
oslo.service provides a framework for defining new long-running services using the patterns established by other OpenStack applications. It also includes utilities long-running applications might need for working with SSL or WSGI, performing periodic operations, interacting with systemd, etc.
- Free software: Apache license
- Documentation: http://docs.openstack.org/developer/oslo.service
- Source: http://git.openstack.org/cgit/openstack/oslo.service
- Bugs: http://bugs.launchpad.net/oslo.service
Description
Languages
Python
100%