Migrating a model back to controller fails: model XXXX has been removed

Bug #1641824 reported by Menno Finlay-Smits
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Christian Muirhead

Bug Description

It's currently not possible to migrate a model from controller A to B and then back to A again. During the import phase an error like ""model XXXX has been removed" is reported causing the migration to abort.

The regression seems to be caused by recent fixes to the StatePool type, specifically this commit: e6d51734.

tags: added: model-migration
Revision history for this message
Christian Muirhead (2-xtian) wrote :

This is because the state is still in the StatePool but marked as removed. It turns out there are a number of places that get states from the pool but never release them back. When the migration finishes it marks the state for the migrated pool to be removed but waits until any current users are finished with it - since the references never get to 0 it's not removed, and it just hangs around even though the underlying model is gone. Then when the reverse migration is started it fails because getting a removed state from the pool is forbidden.

This PR fixes all but one of the cases: https://github.com/juju/juju/pull/6566

The remaining place is here: https://github.com/juju/juju/blob/staging/apiserver/apiserver.go#L470

Each Connect func needs to hang on to the context and release the state returned from the ctxt.stateForRequest methods.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

Last PR for a fix (against develop): https://github.com/juju/juju/pull/6703

Revision history for this message
Christian Muirhead (2-xtian) wrote :

Same change against 2.1 branch: https://github.com/juju/juju/pull/6711

Revision history for this message
Christian Muirhead (2-xtian) wrote :

Backported to 2.0: https://github.com/juju/juju/pull/6713

Although migrations aren't available in 2.0, the same leak occurs on model destruction.

Changed in juju:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in juju:
milestone: 2.1.0 → 2.1-beta3
Curtis Hovey (sinzui)
Changed in juju:
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.