diff --git a/checkin_notes b/checkin_notes index fb9d98eadc..1df26ed17d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8538,3 +8538,18 @@ David 25 June 2005 client/ cs_scheduler.C + +David 26 June 2005 + - scheduler: when handling a reported result, + cap CPU time at now - sent_time. + (from Rattledagger) + + Note: this assumes that applications never use >1 CPU + for non-graphical computation. + Currently this is the case, + but if it changes we need to rethink this check. + + db/ + boinc_db.C,h + sched/ + handle_request.C diff --git a/db/boinc_db.C b/db/boinc_db.C index 53b55d96b4..d2daa0ab86 100644 --- a/db/boinc_db.C +++ b/db/boinc_db.C @@ -1264,6 +1264,7 @@ int DB_WORK_ITEM::enumerate( // The items that appear here must agree with those that appear in the // enumerate method just below! +// void SCHED_RESULT_ITEM::parse(MYSQL_ROW& r) { int i=0; clear(); @@ -1273,6 +1274,7 @@ void SCHED_RESULT_ITEM::parse(MYSQL_ROW& r) { server_state = atoi(r[i++]); hostid = atoi(r[i++]); userid = atoi(r[i++]); + sent_time = atoi(r[i++]); received_time = atoi(r[i++]); } @@ -1300,6 +1302,7 @@ int DB_SCHED_RESULT_ITEM_SET::enumerate() { " server_state, " " hostid, " " userid, " + " sent_time, " " received_time " "FROM " " result " diff --git a/db/boinc_db.h b/db/boinc_db.h index 573267e18f..d6329668b0 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -648,6 +648,7 @@ struct SCHED_RESULT_ITEM { int hostid; int userid; int teamid; + int sent_time; int received_time; double cpu_time; double claimed_credit; diff --git a/sched/handle_request.C b/sched/handle_request.C index f3f7fa5c2d..d66c3583bc 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -601,6 +601,24 @@ int handle_results(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { srip->received_time = time(0); srip->client_state = rp->client_state; srip->cpu_time = rp->cpu_time; + + // check for impossible CPU time + // + double elapsed_time = srip->received_time - srip->sent_time; + if (elapsed_time < 0) { + log_messages.printf(SCHED_MSG_LOG::NORMAL, + "[RESULT#%d] inconsistent sent/received times\n", srip->id + ); + } else { + if (srip->cpu_time > elapsed_time) { + log_messages.printf(SCHED_MSG_LOG::NORMAL, + "[RESULT#%d] excessive CPU time reported: %f\n", + srip->id, srip->cpu_time + ); + srip->cpu_time = elapsed_time; + } + } + srip->exit_status = rp->exit_status; srip->app_version_num = rp->app_version_num; if (rp->fpops_cumulative) {