-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Substantial drift issue #1802
Comments
Are you running the latest version? If someone changed the timezone of the machine you may have to restart the worker/flower. Sent from my iPhone
|
I am running the latest celery. The timezone of the box has not been changed. This happens every time flower is run against celery. |
You should find out if celery.utils.timeutils.utcoffset() returns the correct value for each node Sent from my iPhone
|
This is currently running on my local machine. When I run
|
I'm having a similar issue. I'm passing in my whole Django settings.
I'm in PST.
In my Django settings, which I'm passing to celery with
I start flower with the same config:
Even when I try to set:
The drift exists. However, if I set the |
I've pasted the relevant info from my settings file.
I am in Toronto ("America/Toronto"). |
I wonder if maybe Django modifies the timezone in the time module. |
Note that the event timestamps does not use TIME_ZONE, CELERY_ENABLE_UTC or any of the datetime related settings, as it's using the local timezone of the machine only. |
We're having this problem as well. Oh, and it absolutely spams logging output to Loggly, and a ton of bandwidth out from Rackspace. :( Does this really need to be logged on every single task, rather than at worker startup? Please just give us a way to turn this message off. |
I have the same problem.
The tasks are rather long running, at least 300 seconds each, some are multiple times longer. None task runs longer then 90 minutes. The "substantial drift" is reported only on that Using redis 2.2.12 (so a bit older - using the package which comes with my Ubuntu). Load on both machines is about 8 to 10 - running 3 workers on |
I also get a Substantial drift issue with the following setup: celery==3.1.10, flower==0.6.0 On a regular python shell: import time
def utcoffset():
if time.daylight:
return time.altzone // 3600
return time.timezone // 3600 returns With a Events in But Flower reports: There does not seem to be any effect if I switch I am not particularly annoyed by this, I'm just trying to understand ! |
@NotSqrt Are you using Django? I seem to remember seing Django having some side effect on timezones, maybe it does some patching of sorts? |
I use Django, so yes, that might be it. |
Okay : If I set django parameter |
It's definitely Django that is doing this:
Without Django:
So django is changing these somehow |
I should note (for future people who find this issue by googling) is that it can also come up when using 3.1.9 and 3.1.10 together:
Versus:
|
@wolever, you need to upgrade to a more recent version I think, it was probably fixed later than 3.1.9 at least. |
But right, yeah that you are mixing versions may not be immediately obvious, so good idea to remind people to verify that they have upgraded all the hosts :) |
I still see this USE_TZ = True celery version 3.1.18 when I run 'date' in my ubuntu box another ubuntu box with timezone KST => no substantial drift message |
@pcompassion Is ntpd configured correctly? |
They look correct. |
I'm still seeing this as well:
Server is UTC with these settings:
|
Please include celery version, I fixed an issue with this a long time ago |
I believe that the following line is the offender: celery/celery/utils/timeutils.py Line 359 in def92d5
According to the Python documentation, time.daylight is non-zero if a DST is defined: https://docs.python.org/2/library/time.html#time.daylight However, Celery is treating that value as if it means whether the local time is currently in daylight savings time or standard time. I have a machine set to the America/New_York time zone right now and time.daylight returns 1 even though we are currently in EST not EDT. This causes the utcoffset() method to be off by one in the winter here, which causes adjust_timestamp to be wrong by one hour. To fix this, I suggest dropping the usage of local time everywhere in Celery and use UTC only for all timestamps. I believe this will greatly simplify things! |
NIce catch @rbarlow . |
Pulp had been using the timestamp attribute of Celery's Events to determine when the workers were most recently available. Due to a bug in Celery, this cause an off-by-one-hour bug for users who live in a locale that does daylight savings time that is not currently observing daylight savings time (such as New York in the winter): celery/celery#1802 (comment) This fixes the issue by using the local_received time which is computed in the receiver by Celery with time.time() without any timezone shifting attempts. https://pulp.plan.io/issues/1380 fixes pulp#1380
I believe this was fixed by 85fbe12 |
And this patch is part of 3.1.20, so please try upgrading :) The events don't actually use timestamps for anything but displaying the human time of the event, as fallback ordering, so I just tried finding the simplest backward compatible solution that I could find. Using pytz/datetime added lots of overhead which was a problem when we have to process 4 times as many events, as there are tasks in the cluster. |
On 3.1.20 I sometimes get e.g. |
me too ! @fillest +1 |
@ask This won't go away eh? |
adding,
to django settings and adding, |
It doesn't matter if the clocks are synced by NTP actually. The clock drift is based on the timestamp in the message, and the time we received it. So if the worker is not able to keep up with the events, and process them too late, the drift warning will be produced. You should set the CELERY_EVENT_QUEUE_TTL, CELERY_EVENT_QUEUE_EXPIRES setting to avoid this (these will be enabled by default in 4.0) |
we have some strange 'clock out of sync' problem between the workers because of the timezones of the different machine seems to be corrected in newer celery version: celery/celery#1802
We also noticed this to happen today with celery version 3.1.23 !!! 2017-01-25 11:36:07,506: WARNING/MainProcess] Substantial drift from celery@Walters-MacBook-Pro.local may mean clocks are out of sync. Current drift is |
Did you try upgrading to 4.x? |
I had the same issue, but changing |
Hi, Celery version: 4.0.2
|
@maxandron The information provided isn't enough to debug this issue. Please open a new issue with the necessary information for us to debug this problem. |
@thedrow Thank you for the reply, what kind of information will be helpful? |
@maxandron See the checklist when opening a new issue. |
I got this warning and can't fix with set timezone, finally I found that I only restart the worker but didn't restart the web app... |
@ask . How to ensure that the worker can keep up with the events? This happened to me when I scaled my worker to 100 and up.. Should I increase the resource of my RabbitMQ that serves as a broker on my celery workers? I am using celery 4.2.0 |
Please use the mailing list, IRC or stack overflow for such questions. |
Similar to the other "Substantial drift" issues, I am seeing the following:
As you can see, the tasks are being created at the correct time, but it is saying it was received an hour later. I suspect it's a DST issue - do we think this is a problem on Flower's end or a Celery issue?
The text was updated successfully, but these errors were encountered: