resource cleanup should use Cleanups instead of direct Remove

Bug #1846310 reported by John A Meinel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

Currently the code to cleanup Resource objects just directly tracks the refcount and Removes the object if there are no more references. This works ok in the happy path. But doesn't handle failure/retries properly.

The main issue is that refcount decrementing was triggered by some higher level operation (eg a charm is upgraded, so we no longer refer to that charm archive). However, that action won't ever happen again, so if there is a failure during cleanup, nothing ever schedules it to be removed.

Also, the code is correct to remove from the top down. So managedStoredResources refer to storedResources refer to blobstore.files refer to blobstore.chunks. We remove the managedStoredResources first, which is probably correct, as it makes the object no longer available, rather than being available but having incomplete data.

However, if the first succeeds, but the second fails, nothing knows that it needs to be cleaned up.

Which is what Cleanup steps are for. You end up with a queue of Cleanups to run. And if one of them cannot proceed/fails, it gets rescheduled for later until it finally succeeds.

Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
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.