-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use monotonic time for delays, etc. #912
Conversation
Please see discussion in #468. I'd rather not pull in a whole third party lib to get this, but we can probably support monotonic using Python 3's built-in module if you want to submit a patch for that. |
It actually uses time.monotonic if available |
Yeah, what I'm saying in #468 (comment) is that we can probably just import it from Python 3 if available, otherwise work as it does now. It's probably not worth bringing in a whole third party library, and the Python community seems to be moving towards Python 3 anyway. |
Ok... not an option for me, as I need it for python2.7 |
I spent some time working on issues related to time changes (here, here, and here) without requiring monotonic time. If the time changes right in the middle of a process start or stop, delays can be affected ( |
I was already using 3.3.1 and had issues. IMHO it is pretty serious if supervisor can't deal with system time changes when processes are started... |
If you found problems other than
I see these two problems:
Normally, the system time changes only by a second or two, and it's not likely to happen right in the middle of these events unless you have a high rate of processes starting/stopping. In most configurations I have seen, I do think it's a good idea to use the built-in monotonic module on Python 3 if it's available and I would merge a patch for that. I'm not enthusiastic about bundling a third party library that uses a bunch of
|
As I said my device (Nvidia TK1 board) does not have a battery, so system time jumps by a couple of years as soon as NTP is available... What I noticed is that this happens during the start process and supervisorctl hence shows some process being up for a couple of thousand days. To start things in order I'm using an event listener: https://github.com/flixr/ordered-startup-supervisord Also since Nvidia only provides drivers for Ubuntu 14.04, using systemd is very unfortunately not an option for me... I can understand that you are reluctant to merge this with the ctypes implementation... |
Ah, that makes sense, yeah. The uptime is informational only shouldn't affect
Maybe you could delay
Oh, cool, I didn't know about that. It's not on the plugins list yet.
The release versions are the 3.x branches and are Python 2 only. The master branch will become Supervisor 4 and will support Python 2.6+ and 3.2+. There are are a few python 3 issues remaining but it's getting closer. I would definitely take a patch to add monotonic support on Python 3 like discussed in #468 (comment). |
Yes. But also at least one process also didn't come up and I suspected
Thanks for the tips, but this is unfortunately also not an option as it has to work regardless if there is NTP (or PTP) available...
It's really simple and originally not by me... that is just my fork of https://github.com/jasoncorbett/ordered-startup-supervisord with some additional fixes and features...
Ok... will try that when I have some spare time and make a new PR... right now I just need to get this to work somehow ASAP |
In case someone is interested in a Debian package for Ubuntu 14.04 (trusty) with the monotonic fixes: |
Using the system clock for checking timeouts, delays, etc.. is not robust as the system time might jump (e.g. due to NTP, PTP or other time updates)
So make sure we use the monotonic clock to compute durations (where we don't care about the actual time anyway).
Uses monotonic.py from https://github.com/atdt/monotonic