Merge pull request #2714 from etschannen/release-6.2

fix: only delete the processId file on binaryReader errors
This commit is contained in:
Evan Tschannen 2020-02-20 23:05:39 -08:00 committed by GitHub
commit 0b732ac9c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -1403,9 +1403,16 @@ ACTOR Future<UID> createAndLockProcessIdFile(std::string folder) {
int64_t fileSize = wait(lockFile.get()->size());
state Key fileData = makeString(fileSize);
wait(success(lockFile.get()->read(mutateString(fileData), fileSize, 0)));
processIDUid = BinaryReader::fromStringRef<UID>(fileData, IncludeVersion());
try {
processIDUid = BinaryReader::fromStringRef<UID>(fileData, IncludeVersion());
return processIDUid;
} catch (Error& e) {
if(!g_network->isSimulated()) {
throw;
}
deleteFile(lockFilePath);
}
}
return processIDUid;
}
catch (Error& e) {
if (e.code() == error_code_actor_cancelled) {
@ -1415,12 +1422,7 @@ ACTOR Future<UID> createAndLockProcessIdFile(std::string folder) {
fprintf(stderr, "ERROR: error creating or opening process id file `%s'.\n", joinPath(folder, "processId").c_str());
}
TraceEvent(SevError, "OpenProcessIdError").error(e);
if(!g_network->isSimulated()) {
throw;
}
deleteFile(lockFilePath);
throw;
}
}
}