From 52068b5f2d0cd12378c4200959b9f7fa009cff91 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 20 Aug 2012 19:48:57 +0000 Subject: [PATCH] - client: print log msgs (enabled by task_debug) if the client times out on quitting or aborting a task, and has to kill it. - volunteer storage: bug fixes svn path=/trunk/boinc/; revision=26050 --- checkin_notes | 11 ++++++++++ client/app_control.cpp | 12 +++++++++++ vda/sched_vda.cpp | 48 +++++++++++++++++++++++++++++++++++++----- vda/vda_lib2.cpp | 14 +++++++++--- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/checkin_notes b/checkin_notes index eb2a016d33..0ff4c0d4cb 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5621,3 +5621,14 @@ Charlie 20 Aug 2012 gpu_amd.cpp lib/ coproc.h + +David 20 Aug 2012 + - client: print log msgs (enabled by task_debug) if the client + times out on quitting or aborting a task, and has to kill it. + - volunteer storage: bug fixes + + vda/ + sched_vda.cpp + vda_lib2.cpp + client/ + app_control.cpp diff --git a/client/app_control.cpp b/client/app_control.cpp index 706fc60295..7012a96d44 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -98,11 +98,23 @@ bool ACTIVE_TASK_SET::poll() { ACTIVE_TASK* atp = active_tasks[i]; if (atp->task_state() == PROCESS_ABORT_PENDING) { if (gstate.now > atp->abort_time + ABORT_TIMEOUT) { + if (log_flags.task_debug) { + msg_printf(atp->result->project, MSG_INFO, + "[task] abort request timed out, killing task %s", + atp->result->name + ); + } atp->kill_task(false); } } if (atp->task_state() == PROCESS_QUIT_PENDING) { if (gstate.now > atp->quit_time + QUIT_TIMEOUT) { + if (log_flags.task_debug) { + msg_printf(atp->result->project, MSG_INFO, + "[task] quit request timed out, killing task %s", + atp->result->name + ); + } atp->kill_task(true); } } diff --git a/vda/sched_vda.cpp b/vda/sched_vda.cpp index 6f68713b69..0365ec6fa5 100644 --- a/vda/sched_vda.cpp +++ b/vda/sched_vda.cpp @@ -229,7 +229,7 @@ static int process_completed_upload(char* phys_filename, CHUNK_LIST& chunks) { // - mark vda_file for update // static void process_chunk_present_on_client(FILE_INFO& fi, CHUNK_LIST& chunks) { - char fname[256], chunk_name[256], buf[256]; + char fname[256], chunk_name[256], buf[1024]; int hostid, retval; retval = parse_physical_filename(fi.name, hostid, chunk_name, fname); if (retval) { @@ -243,15 +243,21 @@ static void process_chunk_present_on_client(FILE_INFO& fi, CHUNK_LIST& chunks) { sprintf(buf, "where file_name='%s'", fname); retval = vf.lookup(buf); if (retval) { - log_messages.printf(MSG_CRITICAL, "No VDA file %s\n", fname); + log_messages.printf(MSG_CRITICAL, + "No VDA file for %s, deleting\n", fi.name + ); + delete_file_xml(fi.name, buf); + g_reply->file_transfer_requests.push_back(string(buf)); return; } if (fi.nbytes != vf.chunk_size) { log_messages.printf(MSG_CRITICAL, - "wrong chunk size: %.0f != %.0f\n", - fi.nbytes, vf.chunk_size + "wrong chunk size for %s: %.0f != %.0f, deleting\n", + fi.name, fi.nbytes, vf.chunk_size ); + delete_file_xml(fi.name, buf); + g_reply->file_transfer_requests.push_back(string(buf)); return; } @@ -368,12 +374,24 @@ static int enforce_quota(CHUNK_LIST& chunks) { return 0; } +// does the host already have a result of the given name? +// +static bool result_already_on_host(const char* name) { + for (unsigned int i=0; iother_results.size(); i++) { + OTHER_RESULT& r = g_request->other_results[i]; + if (!strcmp(r.name, name)) { + return true; + } + } + return false; +} + // issue upload and download commands // static int issue_transfer_commands(CHUNK_LIST& chunks) { char xml_buf[8192], chunk_name[256], file_name[1024]; int retval; - char url[1024]; + char url[1024], buf[1024]; CHUNK_LIST::iterator it; for (it = chunks.begin(); it != chunks.end(); it++) { @@ -387,6 +405,16 @@ static int issue_transfer_commands(CHUNK_LIST& chunks) { if (ch.present_on_host) { // upload // + sprintf(buf, "upload_%s", ch.physical_file_name); + if (result_already_on_host(buf)) { + if (config.debug_vda) { + log_messages.printf(MSG_NORMAL, + "[vda] upload of %s already in progress\n", + ch.physical_file_name + ); + } + continue; + } if (config.debug_vda) { log_messages.printf(MSG_NORMAL, "[vda] sending command to upload %s\n", @@ -407,6 +435,16 @@ static int issue_transfer_commands(CHUNK_LIST& chunks) { } else { // download // + sprintf(buf, "download_%s", ch.physical_file_name); + if (result_already_on_host(buf)) { + if (config.debug_vda) { + log_messages.printf(MSG_NORMAL, + "[vda] download of %s already in progress\n", + ch.physical_file_name + ); + } + continue; + } char md5[64], chunk_dir[1024]; int hostid; if (config.debug_vda) { diff --git a/vda/vda_lib2.cpp b/vda/vda_lib2.cpp index 48b0e418cd..b54585ff6d 100644 --- a/vda/vda_lib2.cpp +++ b/vda/vda_lib2.cpp @@ -308,7 +308,12 @@ int META_CHUNK::decode() { // char linkpath[1024], filepath[1024]; sprintf(linkpath, "%s/data.vda", dir); - readlink(linkpath, filepath, sizeof(filepath)); + ssize_t n = readlink(linkpath, filepath, sizeof(filepath)); + if (n < 0) { + perror("readlink"); + return -1; + } + filepath[n] = 0; sprintf(cmd, "mv %s/Coding/data_decoded.vda %s", dir, filepath); system(cmd); return 0; @@ -318,6 +323,7 @@ int META_CHUNK::decode() { // int META_CHUNK::reconstruct() { unsigned int i; + int retval; // reconstruct enough children that we can reconstruct ourself // @@ -326,13 +332,15 @@ int META_CHUNK::reconstruct() { for (i=0; istatus == PRESENT) { - cp->reconstruct(); + retval = cp->reconstruct(); + if (retval) return retval; n++; if (n == coding.n) break; } } } - decode(); + retval = decode(); + if (retval) return retval; // then delete childrens' files //