-
Notifications
You must be signed in to change notification settings - Fork 117
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
Daylight Savings Issue #86
Comments
I believe part of my issue was due to the duplicate job handling the DST change. https://github.com/aptible/supercronic#duplicate-jobs I see I can disable this behavior but it would still cause supercronic to log warnings (out of control in this case). |
The fix was adding docker-compose.yml Use the following steps to replicate the issue: Use timezone in Dockerfile:
Set time (CentOS) specific:
Start containers:
You should see a stream of log messages like:
|
This is worth investigating, I don't have a lot of time to look right now, but we should keep this open so we don't lose track of it. Thanks for sharing detailed repro instructions! |
The issue appears to be caused by this block in During the forward transition, an hour's worth of error logs are generated due to |
DST issue still exists. For example: func TestGetNextTime(t *testing.T) {
laLoc, _ = time.LoadLocation("America/Los_Angeles")
now := time.Date(2024, 3, 10, 01, 59, 40, 0, laLoc)
expr := cronexpr.MustParse("*/30 * * * * * *")
next := expr.Next(now)
fmt.Printf("now: %v, unix: %v, utc: %v\n", now, now.Unix(), now.UTC())
fmt.Printf("next: %v, unix: %v, utc: %v\n", next, next.Unix(), next.UTC())
} Output: now: 2024-03-10 01:59:40 -0800 PST, unix: 1710064780, utc: 2024-03-10 09:59:40 +0000 UTC
next: 2024-03-10 01:00:00 -0800 PST, unix: 1710061200, utc: 2024-03-10 09:00:00 +0000 UTC According to my understanding, the expected next time should be Is this a DST bug or am I understanding it incorrectly. |
This patch should clear up your issue, but it produces some potentially confusing behavior around DST boundaries (ex.
|
Is this patch released yet? I can't find it in any releases. |
I haven't submitted the change as a PR yet. There's some more work to be done prior to that, but I figured I'd copy it here in case it's helpful on the 3rd. |
I had an issue this past Sunday morning during the daylight savings spring forward. I have a cron job that runs every minute, and when the change-over occurred supercronic started logging the following message continually for about 10 minutes until it filled up my VM with a 40gb log file.
{"log":"time=\"2021-03-14T01:00:00-08:00\" level=warning msg=\"not starting: job is still running since 2021-03-14 01:00:00 -0800 PST (0s elapsed)\" iteration=104 job.command=\"/bin/bash -l -c 'cd /home/deploy/app \u0026\u0026 RAILS_ENV=production bundle exec rake process --silent \u003e\u003e /proc/1/fd/1 2\u003e\u003e /proc/1/fd/2'\" job.position=2 job.schedule=\"0 * * * *\"\n","stream":"stderr","time":"2021-03-14T09:00:00.041059641Z"}
I'm setting my localtime zone in my Dockerfile:
Should I stick to UTC in my container and set the timezone in my cron job? I'm running supercronic version 0.1.11.
The text was updated successfully, but these errors were encountered: