diff --git a/checkin_notes b/checkin_notes index f0f7e96c2b..6b129b3491 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1491,3 +1491,20 @@ David 7 Feb 2012 lib/ gui_rpc_client_ops.cpp gui_rpc_client.h + +David 7 Feb 2012 + - client: fix bug in async file verify. + File verify is done in 4 places: + - after a download finishes + - transition result to DOWNLOADED + - if project->verify_files_on_app_start, on app start + Use asynchrony only in the first 2 cases, + since the async logic is set up to mark the file as PRESENT + when done, not to restart a task + + client/ + client_types.h + app_start.cpp + pers_file_xfer.cpp + cs_apps.cpp + cs_files.cpp diff --git a/client/app_start.cpp b/client/app_start.cpp index 1ab4ca7a3d..88dbab019b 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -501,7 +501,7 @@ int ACTIVE_TASK::start(bool first_time) { return 0; } - // if this job less than one CPU, run it at above idle priority + // if this job uses less than one CPU, run it at above idle priority // bool high_priority = (app_version->avg_ncpus < 1); diff --git a/client/client_types.h b/client/client_types.h index 8e8a6f24a8..fc591aca9c 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -151,7 +151,7 @@ struct FILE_INFO { bool had_failure(int& failnum); void failure_message(std::string&); int merge_info(FILE_INFO&); - int verify_file(bool, bool); + int verify_file(bool, bool, bool); bool verify_file_certs(); int gzip(); // gzip file and add .gz to name diff --git a/client/cs_apps.cpp b/client/cs_apps.cpp index b2aa277890..7224272949 100644 --- a/client/cs_apps.cpp +++ b/client/cs_apps.cpp @@ -238,7 +238,7 @@ int CLIENT_STATE::input_files_available( // don't verify app files if using anonymous platform // if (verify_contents && !project->anonymous_platform) { - retval = fip->verify_file(true, true); + retval = fip->verify_file(true, true, false); if (retval) { if (fipp) *fipp = fip; return retval; @@ -254,7 +254,7 @@ int CLIENT_STATE::input_files_available( return ERR_FILE_MISSING; } if (verify_contents) { - retval = fip->verify_file(true, true); + retval = fip->verify_file(true, true, false); if (retval) { if (fipp) *fipp = fip; return retval; diff --git a/client/cs_files.cpp b/client/cs_files.cpp index cb0b029cd8..9415d83224 100644 --- a/client/cs_files.cpp +++ b/client/cs_files.cpp @@ -108,37 +108,51 @@ bool FILE_INFO::verify_file_certs() { // Check the existence and/or validity of a file. // Return 0 if it exists and is valid. -// If "verify_contents" is true, validate the contents of the file -// based either the digital signature of the file or its MD5 checksum. -// Otherwise just check its existence and size. // -// If this check is time-consuming -// (i.e. it involves decompressing and/or computing the MD5 of a large file) -// we do it asynchronously, -// set the file status to FILE_VERIFY_PENDING, -// and return ERR_IN_PROGRESS. -// When the asynchronous op is complete, -// we'll set the status to FILE_PRESENT. +// verify_contents +// if true, validate the contents of the file based either on = +// the digital signature of the file or its MD5 checksum. +// Otherwise just check its existence and size. +// show_errors +// write log msg on failure +// allow_async +// whether the operation can be done asynchronously. +// If this is true, and verify_contents is set +// (i.e. we have to read the file) +// and the file size is above a threshold, +// then we do the operation asynchronously. +// In this case the file status is set to FILE_VERIFY_PENDING +// and we return ERR_IN_PROGRESS. +// When the asynchronous op is complete, +// the status is set to FILE_PRESENT. // // This is called -// 1) right after download is finished +// 1) right after a download is finished // (CLIENT_STATE::create_and_delete_pers_file_xfers() in cs_files.cpp) -// verify_contents is true -// status is FILE_NOT_PRESENT +// precondition: status is FILE_NOT_PRESENT +// verify_contents: true +// show_errors: true +// allow_async: true // 2) to see if a file marked as NOT_PRESENT is actually on disk // (PERS_FILE_XFER::create_xfer() in pers_file_xfer.cpp) -// verify_contents is true -// status is FILE_NOT_PRESENT +// precondition: status is FILE_NOT_PRESENT +// verify_contents: true +// show_errors: false +// allow_async: true // 3) when checking whether a result's input files are available // (CLIENT_STATE::input_files_available( in cs_apps.cpp)). -// verify_contents maybe be either true or false -// status is FILE_PRESENT +// precondition: status is FILE_PRESENT +// verify_contents: either true or false +// show_errors: true +// allow_async: false // -// If a failure occurs, set the file's "status" field. +// If a failure occurs, set the file's "status" field to an error number. // This will cause the app_version or workunit that used the file to error out // (via APP_VERSION::had_download_failure() or WORKUNIT::had_download_failure()) // -int FILE_INFO::verify_file(bool verify_contents, bool show_errors) { +int FILE_INFO::verify_file( + bool verify_contents, bool show_errors, bool allow_async +) { char cksum[64], pathname[256]; bool verified; int retval; @@ -160,7 +174,7 @@ int FILE_INFO::verify_file(bool verify_contents, bool show_errors) { char gzpath[256]; sprintf(gzpath, "%s.gz", pathname); if (boinc_file_exists(gzpath) ) { - if (nbytes > ASYNC_FILE_THRESHOLD) { + if (allow_async && nbytes > ASYNC_FILE_THRESHOLD) { ASYNC_VERIFY* avp = new ASYNC_VERIFY; retval = avp->init(this); if (retval) { @@ -234,7 +248,7 @@ int FILE_INFO::verify_file(bool verify_contents, bool show_errors) { ); return ERR_NO_SIGNATURE; } - if (nbytes > ASYNC_FILE_THRESHOLD) { + if (allow_async && nbytes > ASYNC_FILE_THRESHOLD) { ASYNC_VERIFY* avp = new ASYNC_VERIFY(); retval = avp->init(this); if (retval) { @@ -279,7 +293,7 @@ int FILE_INFO::verify_file(bool verify_contents, bool show_errors) { } } else if (strlen(md5_cksum)) { if (!strlen(cksum)) { - if (nbytes > ASYNC_FILE_THRESHOLD) { + if (allow_async && nbytes > ASYNC_FILE_THRESHOLD) { ASYNC_VERIFY* avp = new ASYNC_VERIFY(); retval = avp->init(this); if (retval) { @@ -392,7 +406,7 @@ bool CLIENT_STATE::create_and_delete_pers_file_xfers() { // verify the file with RSA or MD5, and change permissions // - retval = fip->verify_file(true, true); + retval = fip->verify_file(true, true, true); if (retval == ERR_IN_PROGRESS) { // do nothing } else if (retval) { diff --git a/client/pers_file_xfer.cpp b/client/pers_file_xfer.cpp index 18cd8a7570..c5513c6e46 100644 --- a/client/pers_file_xfer.cpp +++ b/client/pers_file_xfer.cpp @@ -102,7 +102,7 @@ int PERS_FILE_XFER::create_xfer() { char pathname[256]; get_pathname(fip, pathname, sizeof(pathname)); - if (!fip->verify_file(true, false)) { + if (!fip->verify_file(true, false, true)) { retval = fip->set_permissions(); fip->status = FILE_PRESENT; pers_xfer_done = true; diff --git a/doc/get_platforms.inc b/doc/get_platforms.inc index 8d379e78c5..c227ee308f 100644 --- a/doc/get_platforms.inc +++ b/doc/get_platforms.inc @@ -201,7 +201,9 @@ function get_platforms_string($url) { //$x = get_platforms($u); //print_r($x); //echo get_platforms_string("http://setiathome.berkeley.edu/"); -//echo get_platforms_string("http://dist.ist.tugraz.at/cape5/"); +//$x = "http://sat.isa.ru/pdsat/"; +//print_r( get_platforms($x)); + //print_r(get_platforms2("http://www.primegrid.com/")); function wfPlatforms() { diff --git a/doc/projects.inc b/doc/projects.inc index 8546e16fbd..7c877ac68a 100644 --- a/doc/projects.inc +++ b/doc/projects.inc @@ -286,7 +286,7 @@ $math = array( array( array( "SAT@home", - "http://sat.isa.ru/pdsat", + "http://sat.isa.ru/pdsat/", "Institute for Systems Analysis, Russian Academy of Sciences", "Computer Science", "Solve hard and practically important problems (discrete functions inversion problems, discrete optimization, bioinformatics, etc.) that can be effectively reduced to Boolean satisfiability problem.",