From 6337181571c99a19b66d2feef0f2bc2808f41bda Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 12 Aug 2008 19:06:35 +0000 Subject: [PATCH] - scheduler: don't send jobs for "hard apps" (weight==-1) to hosts with total_credit=0 - client: add a buffer size check svn path=/trunk/boinc/; revision=15809 --- checkin_notes | 11 +++++++++++ client/client_msgs.C | 15 +++++++++------ client/main.C | 3 +++ sched/sched_send.C | 7 +++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1f2f7adfd7..fbce3827e1 100644 --- a/checkin_notes +++ b/checkin_notes @@ -6423,3 +6423,14 @@ David 12 Aug 2008 forum_index.php team_members.php white.css + +David 12 Aug 2008 + - scheduler: don't send jobs for "hard apps" (weight==-1) + to hosts with total_credit=0 + - client: add a buffer size check + + client/ + client_msgs.C + main.C + sched/ + sched_send.C diff --git a/client/client_msgs.C b/client/client_msgs.C index 32c0d30d38..542edfa56f 100644 --- a/client/client_msgs.C +++ b/client/client_msgs.C @@ -32,7 +32,7 @@ using std::deque; #define MAX_SAVED_MESSAGES 1000 -// a dequeue of up to MAX_SAVED_MESSAGES most recent messages, +// a cache of MAX_SAVED_MESSAGES most recent messages, // stored in newest-first order // deque message_descs; @@ -47,21 +47,24 @@ void msg_printf(PROJECT *p, int priority, const char *fmt, ...) { if (fmt == NULL) return; - va_start(ap, fmt); // Parses string for variables - vsprintf(buf, fmt, ap); // And convert symbols To actual numbers - va_end(ap); // Results are stored in text + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + buf[sizeof(buf)-1] = 0; + va_end(ap); show_message(p, buf, priority); } -// stash message in memory +// add message to cache, and delete old messages if cache too big // void record_message(PROJECT* p, int priority, int now, char* message) { MESSAGE_DESC* mdp = new MESSAGE_DESC; static int seqno = 1; strcpy(mdp->project_name, ""); if (p) { - strcpy(mdp->project_name, p->get_project_name()); + strlcpy( + mdp->project_name, sizeof(mdp->project_name), p->get_project_name() + ); } mdp->priority = priority; mdp->timestamp = now; diff --git a/client/main.C b/client/main.C index 62d6ae8788..49cb7f2e52 100644 --- a/client/main.C +++ b/client/main.C @@ -108,6 +108,9 @@ void show_message(PROJECT *p, char* msg, int priority) { } else { strlcpy(message, msg, sizeof(message)); } + + // trim trailing \n's + // while (strlen(message)&&message[strlen(message)-1] == '\n') { message[strlen(message)-1] = 0; } diff --git a/sched/sched_send.C b/sched/sched_send.C index 29386046b7..2fca56f466 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -567,10 +567,17 @@ static inline int check_deadline( if (config.ignore_delay_bound) return 0; // skip delay check if host currently doesn't have any work + // and it's not a hard app. // (i.e. everyone gets one result, no matter how slow they are) // if (request.estimated_delay == 0 && !hard_app(app)) return 0; + // if it's a hard app, don't send it to a host with no credit + // + if (hard_app(app) && reply.host.total_credit == 0) { + return INFEASIBLE_CPU; + } + double ewd = estimate_wallclock_duration(wu, request, reply); if (hard_app(app)) ewd *= 1.3; double est_completion_delay = request.estimated_delay + ewd;