Avoid re-downloading data files

Bug #1217098 reported by Barry Warsaw
32
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ubuntu system image
Fix Released
High
Barry Warsaw
system-image (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

pmcgowan reports that if an update is found, and all the data files are downloaded (i.e. through 'prepare_recovery'), but the reboot is not initiated, a subsequent check will find an update available and again try to download all the files. system-image should only download the files once, unless a CancelUpdate is called to force a fresh check (or there was a failure).

Tags: client
Barry Warsaw (barry)
Changed in ubuntu-system-image:
milestone: none → 1.3
assignee: nobody → Barry Warsaw (barry)
importance: Undecided → High
status: New → Triaged
Barry Warsaw (barry)
Changed in ubuntu-system-image:
milestone: 1.3 → none
Changed in ubuntu-system-image:
importance: High → Medium
Revision history for this message
Barry Warsaw (barry) wrote : Re: Avoid re-downloading image files

I think the way I'm going to handle this is like so:

When you re-check for an update, it will re-download everything up to the data files. E.g. it will look for a blacklist, update keyrings, grab the channels.json and index.json files, and re-calculate the upgrade path. If the data files in the winning upgrade path are already downloaded *and* their gpg signatures are still valid, then we can avoid downloading the data files again. We can download only the data files that are missing, or for those with broken signatures (which probably means corruption more than attack).

summary: - Avoid multiple downloads
+ Avoid re-downloading image files
summary: - Avoid re-downloading image files
+ Avoid re-downloading data files
Barry Warsaw (barry)
Changed in ubuntu-system-image:
status: Triaged → In Progress
importance: Medium → High
milestone: none → 2.0
Revision history for this message
Barry Warsaw (barry) wrote :

Here's where I'm stuck at the moment.

Let's say the u/i calls CheckForUpdate() and then DownloadUpdate() (unless automatically downloading) and everything succeeds. So far so good.

But then, the user doesn't click on 'apply' (i.e. ApplyUpdate()) and s-i-dbus idle-exits.

Now sometime in the far future, the user does click on Apply and the u/i calls ApplyUpdate(). A new s-i-dbus will get activated, but it shares none of the state of the previously exited process. Turns out this state is critical to determining whether an update can be applied or not. I haven't been able to figure out a good way to restore that state that doesn't regress a bunch of other tests.

One possible solution would require a bit more interaction with the u/i. On the far-future ApplyUpdate(), the u/i would get an error return (e.g. a non-empty string). It would then have to re-issue the CheckForUpdate() and DownloadUpdate() before it could call ApplyUpdate(). One nice thing though is that if the same upgrade path is still valid, and the data files that were previously downloaded were still valid (i.e. checksums and signatures still match, no invalidating blacklist was added), then those data files will not be re-downloaded.

So the second CFU/DU should be much quicker.

I wonder if that would be acceptable?

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Hey Barry,

That doesn't sounds like a good way of designing the API. The UI shouldn't have to know if this errors is because the daemon timed out and wasn't able to restore its state or because something else on the system is screwed.

For instance, let's imagine we want to report automatically when ApplyUpdate() failed (in addition to the feedback from the user). So, we have to take into account the case "the daemon timeouts and this is excepted to fail" with "there is a real issue on the system"?

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1217098] Re: Avoid re-downloading data files

On Oct 25, 2013, at 07:03 AM, Didier Roche wrote:

>That doesn't sounds like a good way of designing the API. The UI
>shouldn't have to know if this errors is because the daemon timed out
>and wasn't able to restore its state or because something else on the
>system is screwed.
>
>For instance, let's imagine we want to report automatically when
>ApplyUpdate() failed (in addition to the feedback from the user). So, we
>have to take into account the case "the daemon timeouts and this is
>excepted to fail" with "there is a real issue on the system"?

Yeah, I was hoping for an easy way out, but I agree it sucks. ;)

Another possible easy way out would be to not timeout-exit when an upgrade is
fully downloaded and ready to be applied. Of course, the process could exit
for any number of reasons, but waiting to click 'Apply' will probably be the
most common reason.

I'll need to think about this more because it's going to be tough to fix.

Revision history for this message
Barry Warsaw (barry) wrote :

I've finally solved this, but a minor API change will be necessary. See the mailing list for details.

Barry Warsaw (barry)
Changed in ubuntu-system-image:
status: In Progress → Fix Committed
Barry Warsaw (barry)
Changed in ubuntu-system-image:
status: Fix Committed → Fix Released
Barry Warsaw (barry)
Changed in system-image (Ubuntu):
status: New → Fix Committed
Barry Warsaw (barry)
Changed in system-image (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.