Unable to remove an offer, claiming removed relation still exists

Bug #1813886 reported by Stuart Bishop
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Tim McNamara

Bug Description

Attempting to destroy a k8s application, I first need to remove its offer, which fails:

$ juju remove-relation postgresql:db directory-db
$ juju remove-offer admin/modelname.directory-db
ERROR cannot delete application offer "directory-db": offer has 1 relation

Juju status in both models show that no relations exist.

This is Juju 2.5.1-bionic-amd64 from 2.5/edge, testing cross model relations between a k8s model and a local model with a local lxd controller and microk8s.

Revision history for this message
Stuart Bishop (stub) wrote :

juju destroy-model hangs, and there is no --force option, so cleanup requires destroying the controller.

This model may have been stuck due to https://bugs.launchpad.net/juju/+bug/1813884, but the error message is still clearly incorrect and indicates inconsistent state.

tags: added: canonical-is
Revision history for this message
Stuart Bishop (stub) wrote :

(manual destruction of the controller, since destroy-controller --destroy-all-models also hangs and also has no --force option)

Revision history for this message
Ian Booth (wallyworld) wrote :

Do you know what 'juju offers' run on hte offering model printed?
This will show if Juju thinks there are any consumers still using the offer.

Changed in juju:
milestone: none → 2.5.2
importance: Undecided → High
status: New → Triaged
Revision history for this message
Stuart Bishop (stub) wrote :

I can reproduce this.

$ juju offers
Offer User Relation id Status Endpoint Interface Role Ingress subnets
directory-db admin 0 joined postgres pgsql requirer

Full log of reproduction: https://pastebin.ubuntu.com/p/s2cW8jdH5w/

Revision history for this message
Ian Booth (wallyworld) wrote :

I tried to reproduce in a similar way using these charms (also using a LXD controller and microk8s):
- deploy mariadb-k8s charm to k8s model and offer it
- deploy mediawiki to IAAS model and consume the k8s offer

Everything worked as expected.

Can you give me the source to the test k8s charm you are using with postgresql and I can try your exact deployment scenario?

Revision history for this message
Ian Booth (wallyworld) wrote :

Discussed in IRC - it appears that the issue arises when the offering (k8s) charm has not fully come up yet and initialised its pod info. This looks like it falls into the existing class of problem where Juju is not good at removing apps/relations/units etc if there's an underlying error or the charm hasn't started running hooks yet.

Revision history for this message
Stuart Bishop (stub) wrote :

I can confirm that the offer can be removed after the pod has been spun up.

This will be seen in the wild when a k8s charm blocked or waiting for information from a relation before it can usefully spin up the pod.

Changed in juju:
milestone: 2.5.2 → 2.5.3
Changed in juju:
milestone: 2.5.3 → 2.5.4
Changed in juju:
milestone: 2.5.4 → 2.5.5
Changed in juju:
milestone: 2.5.6 → 2.5.8
Revision history for this message
Stuart Bishop (stub) wrote :

This is also happening with Juju 2.6.2 (currently targetted to 2.5.8).

With 2.6.2, 'juju remove-application --force' is failing when models get wedged in this state:

ubuntu@blimp:~$ juju remove-application directory --force
removing application directory failed: cannot destroy application "directory": state changing too quickly; try again soon

Revision history for this message
Stuart Bishop (stub) wrote :

juju destroy-model and juju destroy-model also hang, waiting on the wedged application

Revision history for this message
Stuart Bishop (stub) wrote :

juju destroy-model and juju destroy-model --force also hang, waiting on the wedged application.

Ian Booth (wallyworld)
Changed in juju:
assignee: nobody → Tim McNamara (tim-clicks)
milestone: 2.5.8 → 2.6.3
Ian Booth (wallyworld)
Changed in juju:
assignee: Tim McNamara (tim-clicks) → nobody
Revision history for this message
Jamon Camisso (jamon) wrote :

I ran into this 'in the wild' in that I was attempting to add a unit that failed. Had I waited to consume the offer until after the provisioning was finished it may have been ok.

In any case, having a clean way to remove an offer without destroying the controller would make things a lot better from a user experience perspective.

Ian Booth (wallyworld)
Changed in juju:
assignee: nobody → Tim McNamara (tim-clicks)
Ian Booth (wallyworld)
Changed in juju:
milestone: 2.6.3 → 2.6.4
Changed in juju:
status: Triaged → In Progress
Joel Sing (jsing)
tags: added: juju-k8s
Joel Sing (jsing)
tags: added: k8s
removed: juju-k8s
Changed in juju:
milestone: 2.6.4 → 2.6.5
Revision history for this message
Tim McNamara (tim-clicks) wrote :

The fix[0] for this bug has passed code review. It is should be part of the 2.6.5 release, which is expected to land early next week[1].

[0] https://github.com/juju/juju/pull/10334
[1] https://discourse.jujucharms.com/t/1584

Changed in juju:
status: In Progress → Fix Committed
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.