From 5ef1a160dd8bc2a419579063b007240a1ae0dac3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Apr 2014 12:12:34 -0400 Subject: [PATCH 1/4] typo --- doc/git-annex-shell.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/git-annex-shell.mdwn b/doc/git-annex-shell.mdwn index eafb164682..26ccb9a409 100644 --- a/doc/git-annex-shell.mdwn +++ b/doc/git-annex-shell.mdwn @@ -67,7 +67,7 @@ first "/~/" or "/~user/" is expanded to the specified home directory. * notifychanges - This is used by `git-annex remote-daemon` to be notified when + This is used by `git-annex remotedaemon` to be notified when refs in the remote repository are changed. * gcryptsetup gcryptid From c678798a5c7df75ec9fbcaf6c4ed8f9a897b057d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Apr 2014 14:34:09 -0400 Subject: [PATCH 2/4] assistant: Fix high CPU usage triggered when a monthly fsck is scheduled, and the last time the job ran was a day of the month > 12. This caused a runaway loop. Thanks to Anarcat for his assistance, and to Maximiliano Curia for identifying the cause of this bug. --- Utility/Scheduled.hs | 2 +- debian/changelog | 4 ++++ doc/bugs/assistant_eats_all_CPU.mdwn | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Utility/Scheduled.hs b/Utility/Scheduled.hs index 11e3b569b6..e4b03aac4f 100644 --- a/Utility/Scheduled.hs +++ b/Utility/Scheduled.hs @@ -121,7 +121,7 @@ calcNextTime (Schedule recurrance scheduledtime) lasttime currenttime | otherwise -> skip 1 Monthly Nothing | afterday -> skip 1 - | maybe True (\old -> mnum day > mday old && mday day >= (mday old `mod` minmday)) lastday -> + | maybe True (\old -> mnum day > mnum old && mday day >= (mday old `mod` minmday)) lastday -> -- Window only covers current month, -- in case there is a Divisible requirement. Just $ window day (endOfMonth day) diff --git a/debian/changelog b/debian/changelog index 00ac22c20c..55c1ba3963 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,10 @@ git-annex (5.20140406) UNRELEASED; urgency=medium OSX system has wget installed, which will then be used. * Fix rsync progress parsing in locales that use comma in number display. Closes: #744148 + * assistant: Fix high CPU usage triggered when a monthly fsck is scheduled, + and the last time the job ran was a day of the month > 12. This caused a + runaway loop. Thanks to Anarcat for his assistance, and to Maximiliano + Curia for identifying the cause of this bug. -- Joey Hess Mon, 07 Apr 2014 16:22:02 -0400 diff --git a/doc/bugs/assistant_eats_all_CPU.mdwn b/doc/bugs/assistant_eats_all_CPU.mdwn index 4939bf4567..719fca425a 100644 --- a/doc/bugs/assistant_eats_all_CPU.mdwn +++ b/doc/bugs/assistant_eats_all_CPU.mdwn @@ -520,3 +520,10 @@ $ ps -O start xf | grep git-annex 13761 23:56:38 Z ? 00:00:00 \_ [git] 6252 12:56:59 S ? 00:01:09 /usr/bin/emacs23 """]] + +#### This bug is fixed + +> [[fixed|done]]. This was a Cronner bug, triggered when you had a +> scheduled fsck job that runs monthly at any time, and the last time it ran was on a day of a +> month > 12. Workaround: Disable scheduled fsck jobs, or change them to +> run on a specific day of the month. Or upgrade. --[[Joey]] From e0ca99b480072d5e1b75c7083e8122f087d4a3b0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Apr 2014 14:38:23 -0400 Subject: [PATCH 3/4] rename confusingly named "day" --- Utility/Scheduled.hs | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Utility/Scheduled.hs b/Utility/Scheduled.hs index e4b03aac4f..2b7cae2b65 100644 --- a/Utility/Scheduled.hs +++ b/Utility/Scheduled.hs @@ -108,65 +108,65 @@ calcNextTime (Schedule recurrance scheduledtime) lasttime currenttime window startd endd = NextTimeWindow (LocalTime startd nexttime) (LocalTime endd (TimeOfDay 23 59 0)) - findfrom r afterday day = case r of + findfrom r afterday candidate = case r of Daily - | afterday -> Just $ exactly $ addDays 1 day - | otherwise -> Just $ exactly day + | afterday -> Just $ exactly $ addDays 1 candidate + | otherwise -> Just $ exactly candidate Weekly Nothing | afterday -> skip 1 - | otherwise -> case (wday <$> lastday, wday day) of - (Nothing, _) -> Just $ window day (addDays 6 day) + | otherwise -> case (wday <$> lastday, wday candidate) of + (Nothing, _) -> Just $ window candidate (addDays 6 candidate) (Just old, curr) - | old == curr -> Just $ window day (addDays 6 day) + | old == curr -> Just $ window candidate (addDays 6 candidate) | otherwise -> skip 1 Monthly Nothing | afterday -> skip 1 - | maybe True (\old -> mnum day > mnum old && mday day >= (mday old `mod` minmday)) lastday -> + | maybe True (\old -> mnum candidate > mnum old && mday candidate >= (mday old `mod` minmday)) lastday -> -- Window only covers current month, -- in case there is a Divisible requirement. - Just $ window day (endOfMonth day) + Just $ window candidate (endOfMonth candidate) | otherwise -> skip 1 Yearly Nothing | afterday -> skip 1 - | maybe True (\old -> ynum day > ynum old && yday day >= (yday old `mod` minyday)) lastday -> - Just $ window day (endOfYear day) + | maybe True (\old -> ynum candidate > ynum old && yday candidate >= (yday old `mod` minyday)) lastday -> + Just $ window candidate (endOfYear candidate) | otherwise -> skip 1 Weekly (Just w) | w < 0 || w > maxwday -> Nothing - | w == wday day -> if afterday - then Just $ exactly $ addDays 7 day - else Just $ exactly day + | w == wday candidate -> if afterday + then Just $ exactly $ addDays 7 candidate + else Just $ exactly candidate | otherwise -> Just $ exactly $ - addDays (fromIntegral $ (w - wday day) `mod` 7) day + addDays (fromIntegral $ (w - wday candidate) `mod` 7) candidate Monthly (Just m) | m < 0 || m > maxmday -> Nothing -- TODO can be done more efficiently than recursing - | m == mday day -> if afterday + | m == mday candidate -> if afterday then skip 1 - else Just $ exactly day + else Just $ exactly candidate | otherwise -> skip 1 Yearly (Just y) | y < 0 || y > maxyday -> Nothing - | y == yday day -> if afterday + | y == yday candidate -> if afterday then skip 365 - else Just $ exactly day + else Just $ exactly candidate | otherwise -> skip 1 Divisible n r'@Daily -> handlediv n r' yday (Just maxyday) Divisible n r'@(Weekly _) -> handlediv n r' wnum (Just maxwnum) Divisible n r'@(Monthly _) -> handlediv n r' mnum (Just maxmnum) Divisible n r'@(Yearly _) -> handlediv n r' ynum Nothing - Divisible _ r'@(Divisible _ _) -> findfrom r' afterday day + Divisible _ r'@(Divisible _ _) -> findfrom r' afterday candidate where - skip n = findfrom r False (addDays n day) + skip n = findfrom r False (addDays n candidate) handlediv n r' getval mmax | n > 0 && maybe True (n <=) mmax = - findfromwhere r' (divisible n . getval) afterday day + findfromwhere r' (divisible n . getval) afterday candidate | otherwise = Nothing - findfromwhere r p afterday day + findfromwhere r p afterday candidate | maybe True (p . getday) next = next | otherwise = maybe Nothing (findfromwhere r p True . getday) next where - next = findfrom r afterday day + next = findfrom r afterday candidate getday = localDay . startTime divisible n v = v `rem` n == 0 From bdb81af880fdbb2cefdc7ff256768a4d57c0a131 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Apr 2014 15:01:10 -0400 Subject: [PATCH 4/4] prep release --- debian/changelog | 4 ++-- doc/assistant/release_notes.mdwn | 5 ++++- git-annex.cabal | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 55c1ba3963..bd82732131 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -git-annex (5.20140406) UNRELEASED; urgency=medium +git-annex (5.20140411) unstable; urgency=medium * importfeed: Filename template can now contain an itempubdate variable. Needs feed 0.3.9.2. @@ -12,7 +12,7 @@ git-annex (5.20140406) UNRELEASED; urgency=medium runaway loop. Thanks to Anarcat for his assistance, and to Maximiliano Curia for identifying the cause of this bug. - -- Joey Hess Mon, 07 Apr 2014 16:22:02 -0400 + -- Joey Hess Fri, 11 Apr 2014 14:59:49 -0400 git-annex (5.20140405) unstable; urgency=medium diff --git a/doc/assistant/release_notes.mdwn b/doc/assistant/release_notes.mdwn index 7f13ce9e13..1ed622ba3b 100644 --- a/doc/assistant/release_notes.mdwn +++ b/doc/assistant/release_notes.mdwn @@ -1,4 +1,7 @@ -## version 5.20140406 +## version 5.20140411 + +This release fixes a bug that could cause the assistant to use a *lot* of +CPU, when monthly fscking was set up. Automatic upgrading was broken on OSX for previous versions. This has been fixed, but you'll need to manually upgrade to this version to get it going diff --git a/git-annex.cabal b/git-annex.cabal index 59b7b3a59e..ccbd14724a 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -1,5 +1,5 @@ Name: git-annex -Version: 5.20140405 +Version: 5.20140411 Cabal-Version: >= 1.8 License: GPL-3 Maintainer: Joey Hess