-
Notifications
You must be signed in to change notification settings - Fork 247
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
swclock init: may send the clock backwards of current deptree reference. #675
Comments
A default reference file mtime may send the clock backwards of current deptree mtime. Fixes OpenRC#675
we shouldn't need to create a file just to get the current time. swclock can easily run also, it sounds like you think we should never roll the clock backwards ? clocks can easily be set incorrectly in the future and we need to pull it back. |
Thanks for feedback. Would it then make more sense to add
Sure, it may happen for particular reasons. Thoughts? EDIT: in fact, whatever packaged file reference is taken, clock will be sent (slightly) backwards of current time anyway... We could just make it stable & consistent across release. |
the whole point of swclock is that the system doesn't have a hwclock to keep track of time. it sounds like your system has a hwclock (otherwise, how would time be preserved across boots?), so why are you using swclock in the first place ? |
No my system does not have I came across those unexpected time-shifts, while looking at detailed rc logs trying to figure-out why some service eventually warned about flock issue at start on a fresh system. Then this gated the next question: "why would clock even go backwards in such boot process, if we don't pick a file that forces it (like previous shutdown or any other at user's choice)?" |
i don't know what scenario you're hitting. if your system lacks an RTC, then from a cold or warm boot, the time should be initialized to epoch (1 Jan 1970). the only thing to move it forward in time is swclock. so how do you have a clock that is "current" that swclock is in turn rewinding ? |
Yes, agreed: maybe my "current" statement is a bit confusing. Lines 16/17 So, back to my finer-tuned comment/questions related to
Appreciate your feedback. |
in your case the cold start looks like a first time start? in this case the you don't have the swclock last run timestamp, and also no good reference-able log/history file I believe. if it is not clean shutdown we don't have the timestamp saved, then save timestamp at the start of swclock is useless, you may have some log file newer than it. so, I think we can use epoch time in case it is first time run, and try to find a newest time when no timestamp file. we need to treat timestamp file as a trusted source, we should not create at start of swclock, as if it is a not-clean shutdown/reboot, you can not trust this timestamp. |
Yes indeed. |
@vapier any recommendation on how to address that scenario? |
@williamh would you have any recommendation on how to deal with this scenario on first (cold) boot? |
At first run (
openrc-shutdowntime
does not exist),swclock
sets time according toopenrc-run
file mtime.Until then mtime reference for
deptree
was based on latest mtime found inRC_INITDIR
,RC_CONFDIR
,RC_CONF
& al.In some circumstances it may actually happen
openrc-run
mtime predates such calculateddeptree
date and therefore cause transitional havoc in service starts afterswclock
kicks-in (flock issues): one exemple is described there.What would be the best approach to avoid that?
openrc-run
in the list ofdeptree
inspected locations to set initial mtime?swclock
use another default openrc file fromdeptree
inspected locations, to set its first-time time reference in consistent manner?The text was updated successfully, but these errors were encountered: