-
Notifications
You must be signed in to change notification settings - Fork 121
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
Time drift in Moby VM and containers caused by system sleep #17
Comments
I was able to reproduce this in the GA release, but it looks like it then caught up. I'll check on this when I leave work and return home, and if it's truly fixed then I'll close the issue. |
The issue has cropped back up on my Moby VM. I put my Mac to sleep when I left for work, and it's currently running ~47min behind, and the same is the case for any containers I run.
UPDATE: Moby VM is now 16h behind after the Mac was in sleep mode all night. This is definitely still a problem. |
Hi @alanbrent, The time should resync after a matter of minutes (if not seconds). For how long is it staying out of sync for you? Do you have NTP on the OSX host? What does It'd also be useful to see the equivalent ( There was supposed to be a section in the troubleshooting guide about NTP issues and possible workarounds, but it looks like it somehow got undone by a rebase somewhere along the line. The diff was:
I'll look at getting this section of the docs reinstated. |
@ijc25
It stays out of sync until I manually restart the Moby VM.
This is what it shows now, which would be "after" sleep. I'd have to reboot to give you a true reading of what it looks like "before" sleep, and I can't stop to do that at the moment.
I ran * via |
I can confirm this is still a problem with the latest beta |
That's strange @ketan, because I actually came here to report that it appears to be fixed for me in the |
Update: i had to reboot my machine the other day and currently I am getting a response from
|
UpdateSo I ran into nasty issues with the beta channel, tried reverting to the stable channel but it didn't fix it. I ended up completely uninstalling Docker and reinstalling stable from scratch. At this point, the time drift issue has not recurred. I'm not sure if this should be considered related, because I've yet to see a no-response to |
@alanbrent @ketan are either of you still seeing this issue? If not, I'm tempted to close as we have now updated the troubleshooting documentation |
@dave-tucker — I'm still able to reproduce this. Notice how the created shows If you need any more information, I'm happy to provide it. This is causing a lot of our API clients to be confused about when the instances were actually created.
After a docker restart —
Here's the diagnostic information (Diagnostic ID:
|
@ketan what does |
I just woke up my mac after a good night of sleep. There's about an approx 11 hour drift between the time on my mac and the docker instance. That looks like approximately the time that the lid on my mac was closed.
|
With beta 24 I put my Mac to sleep on battery for about 1.5hrs and when it woke up the clock was originally out by 8s, but the gap closed after about 10s. I'll try on another laptop overnight to see if I can reproduce this. |
Another reporter has version
and got into this state:
and then said
|
I am also seeing this issue and it's causing problems with the applications I have running in containers e.g. AWS APIs rejecting requests:
I can see the workarounds in the troubleshooting docs for Docker for Mac (https://docs.docker.com/docker-for-mac/troubleshoot/#/known-issues), but is there any timeline for this issue to be fixed? |
Related #693 Very annoying bug, which also existed in |
It's back for me. Expected behaviorLast login: Wed Oct 5 22:53:10 on ttys001 This has been working correctly for a few days. Actual behavior this morning when I happened to check.$ docker run --rm centos:7 date -u && date -u remote refid st t when poll reach delay offset jitteruslax1-ntp-002. .GPSs. 1 u 71m 1024 16 39.530 -0.200 241.736 Information
Steps to reproduce the behavior
Ran the diagnostic |
Just to confirm that this is still a problem (I'm on the beta channel). Since my mac is living 'the future' from container and moby vm point of view, the problem is that timestamps of files changed on the mac (through a volume) do not exist yet in the container. |
Also happening on 1.13.1 (15353). Skew is proportional to the amount of time that mac goes to sleep. Restarting the docker engine fixes the skew. |
A lot of our users have been complaining about this, since our application uses AWS services calls which are very picky about clocks being in sync. |
I also had issues where my MySQL instance got out of date. |
very simple way to fix the clockdrift bug:
|
I rather to prefer a cron job on alpine that do hwclock -s. It's simpler and I already did this on my docker server. Nothing to install. It just works. |
thanks for your feedback @venth. We are working on fixing it for the next release. |
This happens after a fresh reboot as well. No need to enter sleep mode. |
FYI
|
Confirmed that this is still happpening in stable channel version: Makes it hard to do crypto stuff when the clock is off. Posting my workaround from bits gathered elsewhere is to force clock sync in the busybox image running the docker containers. First you connect to the moby image:
Then force a clock sync from the system:
Now the clock is more or less in sync:
Running Hoping for a better long term solution comes out of this thread that is many many months old. :( |
@djs55 any updates from the Docker side here? This is causing lots of pain all over the place. |
this is quite of an issue for our dev/test environments that we run in docker :( |
Apologies for the delay merging a solution to this into Docker for Mac. A number of the solutions that we've tried have interacted poorly with the power management behaviour (i.e. running something regularly on Our current work involves building a lightweight RPC service into Hyperkit that can execute a whitelisted set of commands such as This is similar to the workaround with
Apologies again for the delay -- this is very much on our radar to fix. |
We're having the same problem here. |
There is an improvement in the latest Docker for mac release it seems, I don't know yet to what extent it "solves" the issue |
In the latest edge release of Docker for Mac (17.05.0-ce-mac9) time is synchronised automatically after sleep - this fix will also be in stable 17.06 when it is released next month. The HyperKit driver running on the host will now detect a wakeup from sleep and signal a new daemon in the guest ( As Anil mentioned in #17 (comment), this is similar to some of the workarounds posted here, but the command is run directly in the guest to not interfere with the regular Docker setup. To compensate for time drift when not sleeping Although this should greatly improve the current situation a proper fix would be to implement a clock that was pinned to the host so we didn't have to synchronise the time. Currently we're unable to do that, see moby/hyperkit #110 (comment). I'm closing this issue as the reported problem should now be fixed. Please open a new issue if you are running a version newer than 17.05.0-ce-mac9 and still see this or similar issues |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Expected behavior
When the Mac wakes from sleep, the Moby VM should resync its local system time with the Mac's system time.
Actual behavior
Moby VM time simply resumes counting from the time the Mac went to sleep. This results in strange and many times difficult to troubleshoot issues with software running in containers.
Information
Steps to reproduce the behavior
n
seconds/minutes/hoursdate
in container or Moby VM and see that it outputs$(date) - n
The text was updated successfully, but these errors were encountered: