From 8aa10ee5a9ce7609baeb74863cace66ef45c5c8c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 18 Mar 2014 20:19:04 -0700 Subject: [PATCH] scheduler: check if cpu_time and elapsed_time are infinite, set to zero if so Some (old? buggy?) clients report these as infinity. This causes the result update queries to fail. --- lib/util.cpp | 3 +-- sched/sched_types.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/util.cpp b/lib/util.cpp index 909aa1e007..459ffb7f17 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -539,10 +539,9 @@ int wait_client_mutex(const char* dir, double timeout) { return retval; } -bool boinc_is_finite(double x) { +inline bool boinc_is_finite(double x) { #if defined (HPUX_SOURCE) return _Isfinite(x); - return false; #else return finite(x) != 0; #endif diff --git a/sched/sched_types.cpp b/sched/sched_types.cpp index 02e8b13b3c..9ae92038b3 100644 --- a/sched/sched_types.cpp +++ b/sched/sched_types.cpp @@ -1147,8 +1147,18 @@ int SCHED_DB_RESULT::parse_from_client(XML_PARSER& xp) { } if (xp.parse_str("name", name, sizeof(name))) continue; if (xp.parse_int("state", client_state)) continue; - if (xp.parse_double("final_cpu_time", cpu_time)) continue; - if (xp.parse_double("final_elapsed_time", elapsed_time)) continue; + if (xp.parse_double("final_cpu_time", cpu_time)) { + if (!boinc_is_finite(cpu_time)) { + cpu_time = 0; + } + continue; + } + if (xp.parse_double("final_elapsed_time", elapsed_time)) { + if (!boinc_is_finite(elapsed_time)) { + elapsed_time = 0; + } + continue; + } if (xp.parse_int("exit_status", exit_status)) continue; if (xp.parse_int("app_version_num", app_version_num)) continue; if (xp.match_tag("file_info")) {