t.a.i.backoffPolicy fails after a certain number of retries (builtins.OverflowError) #9476
Closed
Description
@wiml reported | |
---|---|
Trac ID | trac#9476 |
Type | defect |
Created | 2018-07-02 21:05:08Z |
I have some connections which can go down for a while, but I want to keep checking (once per minute, e.g.) until they become reachable again. Supposedly, I can do this with the maxDelay
parameter of backoffPolicy
.
After a while, though, instead of continuing to re-try, policy
will start raising an exception:
Jul 02 12:59:22 [8534]: File ".../python3.6/site-packages/automat/_methodical.py", line 135, in _connectionFailed
Jul 02 12:59:22 [8534]: value = output(oself, *args, **kwargs)
Jul 02 12:59:22 [8534]: File ".../python3.6/site-packages/automat/_methodical.py", line 169, in __call__
Jul 02 12:59:22 [8534]: return self.method(oself, *args, **kwargs)
Jul 02 12:59:22 [8534]: File ".../python3.6/site-packages/twisted/application/internet.py", line 740, in _ignoreAndWait
Jul 02 12:59:22 [8534]: return self._doWait()
Jul 02 12:59:22 [8534]: File ".../python3.6/site-packages/twisted/application/internet.py", line 744, in _doWait
Jul 02 12:59:22 [8534]: delay = self._timeoutForAttempt(self._failedAttempts)
Jul 02 12:59:22 [8534]: File ".../python3.6/site-packages/twisted/application/internet.py", line 520, in policy
Jul 02 12:59:22 [8534]: return min(initialDelay * (factor ** attempt), maxDelay) + jitter()
Jul 02 12:59:22 [8534]: builtins.OverflowError: (34, 'Numerical result out of range')
(Some pathnames sanitized.) A little investigation shows that once the attempt
count exceeds 1750, the intermediate result is too large to represent in a float
, and so even though it will be discarded and replaced by maxDelay
this will cause retries to fail:
>>> factor = 1.5
>>> (factor ** 1750)
1.4444527745742028e+308
>>> (factor ** 1751)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: (34, 'Numerical result out of range')
This will take only a couple of days at maxDelay=60.0
: less than a weekend.
Versions:
- Twisted==18.4.0
- Python 3.6.3 (default, Jan 4 2018, 16:40:53)
- [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
- CentOS Linux release 7.4.1708 (Core)
Searchable metadata
trac-id__9476 9476
type__defect defect
reporter__wiml wiml
priority__normal normal
milestone__None None
branch__
branch_author__
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1530565508694370 1530565508694370
changetime__1558292011336444 1558292011336444
version__None None
owner__jandelgado jandelgado