Getting error on departed hook

Bug #2019151 reported by joe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PostgreSQL Charm
New
Undecided
Unassigned

Bug Description

Seeing this from juju charm for postgresql, LXD 5.13, juju 2.9.42-ubuntu-amd64

juju status

```
$ juju status
Model Controller Cloud/Region Version SLA Timestamp
core-postgres-main localhost-localhost localhost/localhost 2.9.42 unsupported 22:33:33+02:00

App Version Status Scale Charm Channel Rev Exposed Message
postgresql 14.7 error 1 postgresql latest/stable 290 no hook failed: "db-relation-departed"

Unit Workload Agent Machine Public address Ports Message
postgresql/1* error idle 1 10.153.128.218 5432/tcp hook failed: "db-relation-departed"

Machine State Address Inst id Series AZ Message
1 started 10.153.128.218 juju-4b1d84-1 jammy Running

Offer Application Charm Rev Connected Endpoint Interface Role
postgresql postgresql postgresql 290 0/1 db pgsql provider

```

Host system is kubuntu 22.04,

```
unit-postgresql-1: 22:22:16 INFO juju.worker.uniter awaiting error resolution for "relation-departed" hook
unit-postgresql-1: 22:23:00 INFO juju.worker.uniter awaiting error resolution for "relation-departed" hook
unit-postgresql-1: 22:27:16 INFO juju.worker.uniter awaiting error resolution for "relation-departed" hook
unit-postgresql-1: 22:27:16 INFO unit.postgresql/1.juju-log db:8: Reactive main running for hook db-relation-departed
unit-postgresql-1: 22:27:16 ERROR unit.postgresql/1.juju-log db:8: Unable to find implementation for relation: provides of block-storage
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed ERROR permission denied
unit-postgresql-1: 22:27:16 ERROR unit.postgresql/1.juju-log db:8: Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 73, in main
    hookenv._run_atstart()
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 1348, in _run_atstart
    callback(*args, **kwargs)
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 131, in _startup
    endpoint._manage_departed()
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 214, in _manage_departed
    self.all_departed_units.append(unit)
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 735, in append
    self._save()
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 711, in _save
    unitdata.kv().set(self._cache_key, [item._serialize() for item in self])
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 711, in <listcomp>
    unitdata.kv().set(self._cache_key, [item._serialize() for item in self])
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 612, in _serialize
    'data': dict(self.received_raw),
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 606, in received_raw
    return self.received.raw_data
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 595, in received
    self._data = JSONUnitDataView(hookenv.relation_get(
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 85, in wrapper
    res = func(*args, **kwargs)
  File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 472, in relation_get
    return json.loads(subprocess.check_output(_args).decode('UTF-8'))
  File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-r', 'db:8', '-', 'remote-a332bb6dcd704adf89c2e1f47683f4bf/0']' returned non-zero exit status 1.

unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed Traceback (most recent call last):
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/charm/hooks/db-relation-departed", line 22, in <module>
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed main()
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 73, in main
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed hookenv._run_atstart()
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 1348, in _run_atstart
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed callback(*args, **kwargs)
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 131, in _startup
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed endpoint._manage_departed()
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 214, in _manage_departed
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed self.all_departed_units.append(unit)
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 735, in append
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed self._save()
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 711, in _save
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed unitdata.kv().set(self._cache_key, [item._serialize() for item in self])
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 711, in <listcomp>
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed unitdata.kv().set(self._cache_key, [item._serialize() for item in self])
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 612, in _serialize
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed 'data': dict(self.received_raw),
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 606, in received_raw
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed return self.received.raw_data
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charms/reactive/endpoints.py", line 595, in received
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed self._data = JSONUnitDataView(hookenv.relation_get(
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 85, in wrapper
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed res = func(*args, **kwargs)
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/var/lib/juju/agents/unit-postgresql-1/.venv/lib/python3.10/site-packages/charmhelpers/core/hookenv.py", line 472, in relation_get
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed return json.loads(subprocess.check_output(_args).decode('UTF-8'))
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed File "/usr/lib/python3.10/subprocess.py", line 524, in run
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed raise CalledProcessError(retcode, process.args,
unit-postgresql-1: 22:27:16 WARNING unit.postgresql/1.db-relation-departed subprocess.CalledProcessError: Command '['relation-get', '--format=json', '-r', 'db:8', '-', 'remote-a332bb6dcd704adf89c2e1f47683f4bf/0']' returned non-zero exit status 1.
unit-postgresql-1: 22:27:17 ERROR juju.worker.uniter.operation hook "db-relation-departed" (via explicit, bespoke hook script) failed: exit status 1
unit-postgresql-1: 22:27:17 INFO juju.worker.uniter awaiting error resolution for "relation-departed" hook
unit-postgresql-1: 22:27:59 INFO juju.worker.uniter awaiting error resolution for "relation-departed" hook

```

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.