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

[OPS] Add downloading of new apps to finalize cycle #384

Conversation

NoelsJaan
Copy link

@NoelsJaan NoelsJaan commented Jan 22, 2025

Retry Mechanism:

  • Implement functionality to retry installing apps that fails to run during the first attempt. By retrying the installation of failed apps, the system can handle transient issues and ensure successful addition of new apps.

Possibly closes #383

@NoelsJaan NoelsJaan force-pushed the new-app-in-compose-apps-toml branch from c2d0bda to 0c26a86 Compare January 22, 2025 14:04
@doanac doanac requested review from mike-sul and doanac and removed request for doanac January 24, 2025 13:23
@doanac doanac self-assigned this Jan 24, 2025
@mike-sul
Copy link
Contributor

Hi @NoelsJaan,

Thank you for posting this PR.

Based on my current understanding of your use case, this change should help address the issue you’ve encountered.

Before we can accept this change, we need to:

  1. Ensure it does not break any other use cases or their corner cases (this is an action item for us).
  2. Review the low-level technical details of this change. I’ll post comments on this soon.

I have one question: my understanding is that you are currently using LmP version 94 and need to address this issue in v94. If that’s correct, please rebase this PR to the v94 branch accordingly.

// First we print the run_res error message
LOG_ERROR << "App: " << app_pair.first << ", failed to start: " << run_res.err;
// If this fails it is possible that some apps are missing since they are added in this new target.
LOG_INFO << "Downloading App because it would not start";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (Re-)downloading app before retrying to start it again; app: <>?

@mike-sul
Copy link
Contributor

Currently, I see two issues with the given approach:

  1. If there is not enough free storage to fit a new app, then it will lead to rollback while it should not.

  2. It will lead to huge delay during update finalization and rollback if a device operates at a fully offline mode after reboot and app failure starts occur (some issue with app which is fully pulled).

@mike-sul
Copy link
Contributor

I think we should reconsider approach slightly in order to fulfill all edge cases (e.g. no space) and all other use-cases. At first glance, we need to do the following:

  1. We need to detect whether a required app is missing or not. All other errors should be treated as it now.

  2. If an app is missing then ignore it at the finalization stage, and let the finalize method to start all available apps. Then, the following "sync" update will pull and start all missing apps (or removed one); the "sync" update already handle all possible edge-cases.

@NoelsJaan
Copy link
Author

NoelsJaan commented Jan 28, 2025

Thank you for your feedback @mike-sul!

I agree that the reconsideration of the approach will be a more solid solution. I will have a look at the possibility to detect the error and to differentiate it from the others. That will be a great first step.

@NoelsJaan NoelsJaan marked this pull request as draft January 28, 2025 14:44
@NoelsJaan NoelsJaan force-pushed the new-app-in-compose-apps-toml branch from 0c26a86 to 470b0e9 Compare February 5, 2025 13:51
@NoelsJaan NoelsJaan marked this pull request as ready for review February 5, 2025 13:51
@mike-sul
Copy link
Contributor

@NoelsJaan My understanding is that you are currently using the LmP version 94 and need to address this issue in v94?
If that’s correct, please rebase this PR to the v94 branch accordingly.

LOG_INFO << "(Re-)downloading app before retrying to start it again; app: " << app_pair.first;
const DownloadResult download_res = Download(Target::toTufTarget(target)); // download the missing apps
if(!download_res) {
LOG_ERROR << "Failed to (re-)download the missing apps; app: " << app_pair.first;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to continue the for loop if an error to re-download app occurs?

@mike-sul
Copy link
Contributor

@NoelsJaan Please let me know if this approach works for you?
It finalizes/starts only those apps that were pulled&installed before reboot. After successful finalization the newly enabled apps are synced (a new OTA process starts that pulls, installs, and starts the new apps).

@NoelsJaan
Copy link
Author

@mike-sul yes, this should fix it. Thank you.

@mike-sul
Copy link
Contributor

@NoelsJaan FYI, The proposed fix has been merged into the v94 branch a26ef85.
Also, it has been pushed to the upcoming v95 version 4a54e8d.

If you think that the solution in this PR is still needed then I will create a new PR where both approaches are combined, i.e. optionally (defined by a new configuration variable) an app can be pulled during finalization.

@NoelsJaan NoelsJaan closed this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New App In Compose_apps Toml List Causes Target Failure and Rollback
3 participants