resource cleanup should use Cleanups instead of direct Remove
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 managedStoredRe
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.
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.