Commit 95ee8abb authored by Michele Tartara's avatar Michele Tartara
Browse files

Fix integer overflow problem in hbal

waitForJobs in src/Ganeti/Jobs.hs has an integer overflow that (at least on
amd64) causes it to break after waiting for ~10 minutes. This results in hbal
sleeping forever (when compiled with squeeze's ghc 6.12.1) or crashing (when
compiled with precise's ghc 7.4.1) whenever it has to wait ~10 minutes for a
jobset to complete.

Thanks to for finding the bug and suggesting the fix.

Fixes Issue 717.
Signed-off-by: default avatarMichele Tartara <>
Reviewed-by: default avatarKlaus Aehlig <>
parent 0e2a45dd
......@@ -70,12 +70,12 @@ waitForJobs jids client = waitForJobs' 500000 15000000
waitForJobs' delay maxdelay = do
-- TODO: this should use WaitForJobChange once it's available in Haskell
-- land, instead of a fixed schedule of sleeping intervals.
threadDelay $ min delay maxdelay
threadDelay delay
sts <- L.queryJobsStatus client jids
case sts of
Bad e -> return . Bad $ "Checking job status: " ++ formatError e
Ok sts' -> if any (<= JOB_STATUS_RUNNING) sts' then
waitForJobs' (delay * 2) maxdelay
waitForJobs' (min (delay * 2) maxdelay) maxdelay
return . Ok $ zip jids sts'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment