oslo.service/oslo_service
Davanum Srinivas 6a56ec63bf Fix Heartbeats stop when time is changed
eventlet's hub mechanism defaults to using time.time for figuring
out how long to sleep, when to wake up etc:
https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/epolls.py#L37
https://github.com/eventlet/eventlet/blob/master/eventlet/hubs/hub.py#L344

So if you mess with the system time, anything using loopingcall
will stop working. Best example as described in the bug is
`nova-manage service list` which fails for some services when
the clock is advanced.

If we use a monotonic timer, then we can get past this problem.
In this review we use the EVENTLET_HUB hook to specify
a custom Hub. In our custom Hub, we just delegate to the
existing hub mechanism (get_default_hub()) to create an
instance of the Hub and override the clock with one based
on monotonic.

Note that use_hub() mechanism will not work because that sets
the Hub just for the current thread and will not work for other
threads that may be started later. In order to set this
environment variable early, we set it in the __init__.py so
anyone who uses oslo service will enable this support just
by a simple import referencing anything in oslo.service

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
Closes-Bug: 1510234
Change-Id: I4c1cf223e9f6faa1e6dcaf432be1aa709072a343
2016-03-03 21:21:02 +01:00
..
tests Fix Heartbeats stop when time is changed 2016-03-03 21:21:02 +01:00
__init__.py Fix Heartbeats stop when time is changed 2016-03-03 21:21:02 +01:00
_i18n.py Update translation setup 2016-01-29 11:43:28 +01:00
_options.py Merge "wsgi: decrease the default number of greenthreads in pool" 2016-02-24 05:30:42 +00:00
eventlet_backdoor.py Allow the backdoor to serve from a local unix domain socket 2016-02-18 19:24:19 -08:00
loopingcall.py Avoid warning when time taken is close to zero 2015-12-02 19:51:08 -05:00
periodic_task.py Use reflection.get_class_name() from oslo.utils 2015-11-17 22:14:23 +08:00
service.py Fix misspelling and rewrite sentence 2016-02-04 01:25:13 +00:00
sslutils.py Add Bandit to tox for security static analysis 2015-12-01 16:10:15 +03:00
systemd.py Use contextlib.closing instead of try ... finally: sock.close 2015-08-04 17:57:38 -07:00
threadgroup.py Add Bandit to tox for security static analysis 2015-12-01 16:10:15 +03:00
wsgi.py Fix some inconsistency in docstrings 2016-01-06 15:01:09 +00:00