Skip to content
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

Day '0' out of range 1..30 at /usr/local/sbin/sanoid line 413 #394

Closed
ryanjaeb opened this issue Jun 1, 2019 · 10 comments · Fixed by #406
Closed

Day '0' out of range 1..30 at /usr/local/sbin/sanoid line 413 #394

ryanjaeb opened this issue Jun 1, 2019 · 10 comments · Fixed by #406

Comments

@ryanjaeb
Copy link

ryanjaeb commented Jun 1, 2019

I'm setting up sanoid for the first time today, so it's possible I've configured something wrong, but I followed the CentOS instructions and sanoid.conf example almost exactly. It seems like this broke after UTC rolled over to June 1:

TZ=UTC date && TZ=UTC /usr/local/sbin/sanoid --take-snapshots --verbose
Sat Jun  1 04:20:53 UTC 2019
INFO: taking snapshots...
Day '0' out of range 1..30 at /usr/local/sbin/sanoid line 413.

With my local timezone (-600) which is still at May 31:

date && /usr/local/sbin/sanoid --take-snapshots --verbose
Fri May 31 22:22:48 CST 2019
INFO: taking snapshots...
taking snapshot neo/enc/images/testing@autosnap_2019-05-31_22:22:48_monthly
taking snapshot neo/enc/images/testing@autosnap_2019-05-31_22:22:48_daily
taking snapshot neo/enc/images/testing@autosnap_2019-05-31_22:22:48_hourly
taking snapshot neo/enc/images/testing@autosnap_2019-05-31_22:22:48_frequently
INFO: cache expired - updating from zfs list.
@normanu
Copy link

normanu commented Jun 1, 2019

Same issue here and getting 100's of mails about it

@shodanshok
Copy link
Contributor

I confirm the bug, which was indtroduced here: #362
Sorry for the inconvenience; I am thinking about a workaround, which I should publish later today.

@shodanshok
Copy link
Contributor

shodanshok commented Jun 1, 2019

Hi, here you can find the fast fix: shodanshok@9bb8f8e

The fix basically reverts to the method to calculate the previous day in the special case of the first day of month. Note that this can lead to some duplicate snapshot in the rare case of DST happening the first day of a month (which was the reason I authored the change in the fist place).

For manual patching, copy/save the code above and use the patch <your_sanoid_file> -i <this_patch_file> to apply.

412,413c412,417
<                                               $preferredtime[3] -= 1; # preferred time is later today - so look at yesterday's
<                                               $lastpreferred = timelocal(@preferredtime);
---
>                                               if ($preferredtime[3] > 1) {
>                                                       $preferredtime[3] -= 1; # preferred time is later today - so look at yesterday's
>                                                       $lastpreferred = timelocal(@preferredtime);
>                                               } else {
>                                                       $lastpreferred -= 60*60*24; # workaround for first day of month
>                                               }

@scotws
Copy link

scotws commented Jul 1, 2019

Got this bug today, rollover to July 1st. I can assume I can just wait out the day with the crontab line for sanoid disabled until tomorrow?

@shodanshok
Copy link
Contributor

@scotws Correct.

@normanu
Copy link

normanu commented Jul 1, 2019

@shodanshok the error is still there now also on the 2nd?

@shodanshok
Copy link
Contributor

@normanu On 2nd you should have no problems. Anyway, you can apply the fast fix shown here: shodanshok@9bb8f8e

Be sure to read the entire PR thread here: #395

@shodanshok
Copy link
Contributor

@jimsalterjrs as this is quite an important bug to fix, can you look at #395 or #406 ?
Thanks.

@rwarren
Copy link

rwarren commented Aug 1, 2019

I've also just spontaneously run into this bug. I did nothing to trigger it... it just started happening 2.5 hrs ago on the day flip. See below for reproducing manually (normally on a cronjob):

$ sudo /usr/local/bin/sanoid
INFO: taking snapshots...
Day '0' out of range 1..31 at /usr/local/bin/sanoid line 413.
$ date
Thu Aug  1 02:36:26 UTC 2019

@rwarren
Copy link

rwarren commented Aug 1, 2019

The fix indicated by @shodanshok worked for me:
shodanshok@9bb8f8e

Thanks, @shodanshok !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants