Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #4016: Load the system image if Installation Manager fails #4083

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion starboard/extension/loader_app_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ typedef enum class SlotSelectionStatus {
kRollBackFailedToCheckSabi = 9,
kRollBackFailedToLookUpSymbols = 10,
kEGLite = 11,
kMaxValue = kEGLite,
kLoadSysImgFailedToInitInstallationManager = 12,
kMaxValue = kLoadSysImgFailedToInitInstallationManager,
} SlotSelectionStatus;

typedef struct StarboardExtensionLoaderAppMetricsApi {
Expand Down
10 changes: 10 additions & 0 deletions starboard/loader_app/loader_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,17 @@ void SbEventHandle(const SbEvent* event) {
starboard::loader_app::LoadSlotManagedLibrary(
app_key, alternative_content, &g_cobalt_library_loader,
use_memory_mapped_file));

if (g_sb_event_func == NULL) {
SB_LOG(ERROR) << "Failed to initialize Installation Manager. Loading "
"system image instead.";
starboard::loader_app::RecordSlotSelectionStatus(
SlotSelectionStatus::kLoadSysImgFailedToInitInstallationManager);
LoadLibraryAndInitialize(alternative_content, use_memory_mapped_file);
}
}
// If g_sb_event_func is NULL at this point, the app has no choice but to
// crash.
SB_CHECK(g_sb_event_func);
}

Expand Down
6 changes: 4 additions & 2 deletions starboard/loader_app/slot_management.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ void* LoadSlotManagedLibrary(const std::string& app_key,
LibraryLoader* library_loader,
bool use_memory_mapped_file) {
// Initialize the Installation Manager.
SB_CHECK(ImInitialize(kMaxNumInstallations, app_key.c_str()) == IM_SUCCESS)
<< "Abort. Failed to initialize Installation Manager";
if (ImInitialize(kMaxNumInstallations, app_key.c_str()) != IM_SUCCESS) {
SB_LOG(ERROR) << "Abort. Failed to initialize Installation Manager";
return NULL;
}

// Roll forward if needed.
if (ImRollForwardIfNeeded() == IM_ERROR) {
Expand Down
Loading