Fix asan error caused by StringRef parameter of updateRestoreState

This commit is contained in:
Hui Liu 2023-03-09 11:31:19 -08:00
parent 0c718f7a04
commit 6fca5b4e13
4 changed files with 5 additions and 4 deletions

View File

@ -3545,7 +3545,7 @@ ACTOR Future<Void> recoverBlobManager(Reference<BlobManagerData> bmData) {
// terminate blob restore for non-retryable errors
TraceEvent("ManifestLoadError", bmData->id).error(e).detail("Phase", phase);
std::string errorMessage = fmt::format("Manifest loading error '{}'", e.what());
wait(BlobRestoreController::updateError(restoreController, errorMessage));
wait(BlobRestoreController::updateError(restoreController, StringRef(errorMessage)));
}
}
}

View File

@ -657,7 +657,7 @@ ACTOR Future<Void> blobMigrator(BlobMigratorInterface interf, Reference<AsyncVar
TraceEvent("BlobMigratorError", interf.id()).error(e);
std::string errorMessage = fmt::format("Migrator failure '{}' on {}", e.what(), interf.address().toString());
Reference<BlobRestoreController> restoreController = makeReference<BlobRestoreController>(db, normalKeys);
wait(BlobRestoreController::updateError(restoreController, errorMessage));
wait(BlobRestoreController::updateError(restoreController, StringRef(errorMessage)));
}
return Void();
}

View File

@ -120,7 +120,8 @@ ACTOR Future<Void> BlobRestoreController::updateState(Reference<BlobRestoreContr
return Void();
}
ACTOR Future<Void> BlobRestoreController::updateError(Reference<BlobRestoreController> self, StringRef errorMessage) {
ACTOR Future<Void> BlobRestoreController::updateError(Reference<BlobRestoreController> self,
Standalone<StringRef> errorMessage) {
Standalone<BlobRestoreState> newState;
newState.error = StringRef(newState.arena(), errorMessage);
newState.phase = BlobRestorePhase::ERROR;

View File

@ -183,7 +183,7 @@ public:
ACTOR static Future<Void> updateState(Reference<BlobRestoreController> self,
BlobRestorePhase newPhase,
Optional<BlobRestorePhase> expectedPhase);
ACTOR static Future<Void> updateError(Reference<BlobRestoreController> self, StringRef errorMessage);
ACTOR static Future<Void> updateError(Reference<BlobRestoreController> self, Standalone<StringRef> errorMessage);
private:
Database db_;