Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongo unit error state on teardown #218

Open
markbeierl opened this issue Nov 13, 2023 · 4 comments
Open

Mongo unit error state on teardown #218

markbeierl opened this issue Nov 13, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@markbeierl
Copy link

Steps to reproduce

Destroy a model with multiple applications relationed to mongodb-k8s.

Expected behavior

Model tears down cleanly

Actual behavior

Mongo charm goes into error state. The following is observed in the juju debug-log:

Versions

Operating system: Ubuntu 22.04.3 LTS
Juju CLI: 3.1.7-genericlinux-amd64
Juju agent: 3.1.7
Charm revision: 5/edge 36
microk8s: MicroK8s v1.27.7 revision 6101

Log output

Juju debug log:
log.txt

unit-mongodb-k8s-0: 20:46:42 INFO unit.mongodb-k8s/0.juju-log database:15: Update relation user: relation-7 on free5gc
unit-mongodb-k8s-0: 20:46:42 INFO unit.mongodb-k8s/0.juju-log database:15: Updating relation data according to diff
unit-mongodb-k8s-0: 20:46:42 ERROR unit.mongodb-k8s/0.juju-log database:15: Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/./src/charm.py", line 1218, in <module>
    main(MongoDBCharm)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/main.py", line 441, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/main.py", line 149, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/framework.py", line 344, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/framework.py", line 833, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/framework.py", line 922, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/lib/charms/mongodb/v0/mongodb_provider.py", line 97, in _on_relation_event
    self.oversee_users(departed_relation_id, event)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/lib/charms/mongodb/v0/mongodb_provider.py", line 149, in oversee_users
    self._diff(event)
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/lib/charms/mongodb/v0/mongodb_provider.py", line 175, in _diff
    key: value for key, value in event.relation.data[event.app].items() if key != "data"
  File "/var/lib/juju/agents/unit-mongodb-k8s-0/charm/venv/ops/model.py", line 1361, in __getitem__
    raise KeyError(
KeyError: 'Cannot index relation data with "None". Are you trying to access remote app data during a relation-broken event? This is not allowed.'
unit-mongodb-k8s-0: 20:46:42 ERROR juju.worker.uniter.operation hook "database-relation-broken" (via hook dispatching script: dispatch) failed: exit status 1
@markbeierl markbeierl added the bug Something isn't working label Nov 13, 2023
Copy link

@ghislainbourgeois
Copy link

I hit the same bug when removing a mongo relation, with the exact same stack trace.

@dmitry-ratushnyy
Copy link
Contributor

Thank you very much for reporting the issue, I will take a look into it within a week.

@dariofaccin
Copy link

This issue is still present in channel 6/beta revision 38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants