Skip to content

Commit

Permalink
Fix core download retry logic, Only add client executable directory t…
Browse files Browse the repository at this point in the history
…o lib path on Windows, Retry WU if core crashes. #127
  • Loading branch information
jcoffland committed Mar 9, 2023
1 parent 406b39f commit d1b7cb7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Folding@home Client Changelog
=============================

## v8.1.16
- Fix core download retry logic.
- Only add client executable directory to lib path on Windows.
- Retry WU if core crashes. #127

## v8.1.15
- Fix CUDA/OpenCL driver mixup from v8.1.14.
- Improved OpenCL PCI info detection.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fah-client",
"version": "8.1.15",
"version": "8.1.16",
"bin": {
"fah-client": "./fah-client"
},
Expand Down
4 changes: 2 additions & 2 deletions src/fah/client/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ Core::Core(App &app, const JSON::ValuePtr &data) :
}


string Core::getURL() const {return data->getString("url");}
string Core::getURL() const {return data->getString("url");}
uint32_t Core::getType() const {return data->getU32("type");}
string Core::getPath() const {return data->getString("path");}
string Core::getPath() const {return data->getString("path");}


void Core::addProgressCallback(progress_cb_t cb) {
Expand Down
10 changes: 5 additions & 5 deletions src/fah/client/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ namespace FAH {
public:
Core(App &app, const cb::JSON::ValuePtr &data);

CoreState getState() const {return state;}
bool isReady() const {return state == CORE_READY;}
bool isInvalid() const {return state == CORE_INVALID;}
CoreState getState() const {return state;}
bool isReady() const {return state == CORE_READY;}
bool isInvalid() const {return state == CORE_INVALID;}

std::string getURL() const;
uint32_t getType() const;
std::string getURL() const;
uint32_t getType() const;
std::string getPath() const;

void addProgressCallback(progress_cb_t cb);
Expand Down
24 changes: 15 additions & 9 deletions src/fah/client/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,6 @@ void Unit::getCore() {

if (core->isInvalid()) {
LOG_INFO(1, "Failed to download core");
data.release();
setState(UNIT_ASSIGN);
retry();

} else if (core->isReady()) {
Expand Down Expand Up @@ -590,8 +588,10 @@ void Unit::run() {

// Set environment library paths
vector<string> paths;
#ifdef _WIN32
string execPath = SystemUtilities::getExecutablePath();
paths.push_back(SystemUtilities::dirname(execPath));
#endif
string corePath = SystemUtilities::absolute(core->getPath());
paths.push_back(SystemUtilities::dirname(corePath));
const string &ldPath = SystemUtilities::library_path;
Expand Down Expand Up @@ -758,13 +758,6 @@ void Unit::finalizeRun() {
LOG(CBANG_LOG_DOMAIN, ok ? LOG_INFO_LEVEL(1) : Logger::LEVEL_WARNING,
"Core returned " << code << " (" << (unsigned)code << ')');

#ifdef _WIN32
if (0xc000000 <= code)
LOG_WARNING("Core exited with Windows unhandled exception code "
<< String::printf("0x%08x", (unsigned)code)
<< ". See https://bit.ly/2CXgWkZ for more information.");
#endif

// Notify parent
units->triggerUpdate();

Expand All @@ -784,6 +777,19 @@ void Unit::finalizeRun() {
data->insert("data", Base64().encode(resultData));
setState(UNIT_UPLOAD);

} else if (!code.isValid()) {
#ifdef _WIN32
if (0xc0000000 <= (unsigned)code)
LOG_WARNING("Core exited with Windows unhandled exception code "
<< String::printf("0x%08x", (unsigned)code)
<< ". See https://bit.ly/2CXgWkZ for more information.");
else
#endif
LOG_WARNING("Core exited with an unknown error code " << (unsigned)code
<< " which probably indicates that it crashed");

retry();

} else setState(UNIT_DUMP);

triggerNext();
Expand Down

0 comments on commit d1b7cb7

Please sign in to comment.