canonical / charm-juju-backup-all

Juju Backup All - a charm to perform Juju and database backups
Apache License 2.0
1 stars 5 forks source link

do-backup fails on jammy #9

Closed jneo8 closed 11 months ago

jneo8 commented 11 months ago

When trying to run the do-backup action on a freshly deployed jammy environment, I got this reply: $ juju run-action --wait juju-backup-all/0 do-backup
unit-juju-backup-all-0:
UnitId: juju-backup-all/0
id: "41"
message: exit status 1
results:
ReturnCode: 1
Stderr: |
/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/loop.py:4: UserWarning: juju.loop module is being deprecated by 3.0, use juju.jasyncio instead
warnings.warn('juju.loop module is being deprecated by 3.0, use juju.jasyncio instead')
status: failed
timing:
completed: 2023-04-20 11:45:16 +0000 UTC
enqueued: 2023-04-20 11:45:15 +0000 UTC
started: 2023-04-20 11:45:15 +0000 UTC

The debug log showed the following: unit-juju-backup-all-0: 11:45:15 WARNING unit.juju-backup-all/0.do-backup /var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/loop.py:4: UserWarning: juju.loop module is being deprecated by 3.0, use juju.jasyncio instead unit-juju-backup-all-0: 11:45:15 WARNING unit.juju-backup-all/0.do-backup warnings.warn('juju.loop module is being deprecated by 3.0, use juju.jasyncio instead') unit-juju-backup-all-0: 11:45:15 INFO unit.juju-backup-all/0.juju-log Setting charm primary status True unit-juju-backup-all-0: 11:45:15 ERROR unit.juju-backup-all/0.juju-log Traceback (most recent call last): File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/src/utils.py", line 277, in push_ssh_keys_to_models with connect_controller(controller_name) as controller: File "/usr/lib/python3.10/contextlib.py", line 135, in enter return next(self.gen) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/jujubackupall/utils.py", line 46, in connect_controller run_async(controller.connect(controller_name)) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/jasyncio.py", line 118, in run raise task.exception() File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/controller.py", line 104, in connect await self._connector.connect_controller(controller_name, kwargs) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connector.py", line 103, in connect_controller await self.connect( File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connector.py", line 74, in connect self._connection = await Connection.connect(kwargs) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 338, in connect await self._connect_with_redirect([_ep]) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 852, in _connect_with_redirect login_result = await self._connect_with_login(endpoints) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 819, in _connect_with_login await self._connect(endpoints) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 769, in _connect result = await task File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one return f.result() # May raise f.exception(). File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 758, in _try_endpoint return await self._open(endpoint, cacert) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connection.py", line 400, in _open return (await websockets.connect( File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/websockets/py35/client.py", line 12, in await_impl__ transport, protocol = await self._creating_connection File "/usr/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection transport, protocol = await self._create_connection_transport( File "/usr/lib/python3.10/asyncio/base_events.py", line 1107, in _create_connection_transport protocol = protocol_factory() File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/websockets/client.py", line 411, in factory = lambda: create_protocol( File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/websockets/client.py", line 58, in init super().init(**kwds) File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/websockets/protocol.py", line 218, in init self._drain_lock = asyncio.Lock(loop=loop) File "/usr/lib/python3.10/asyncio/locks.py", line 78, in init super().init(loop=loop) File "/usr/lib/python3.10/asyncio/mixins.py", line 17, in init__ raise TypeError( TypeError: As of 3.10, the loop parameter was removed from Lock() since it is no longer necessary


Imported from Launchpad using lp2gh.

jneo8 commented 11 months ago

(by dashmage) This comment 1 left on a very similar bug for juju-lint charm addresses the same issue. Here is the relevant text talking about the root cause:

It is surfacing from a libjuju dependency package websockets. The problem in a nutshell, websockets>=10.0 adds support for python3.10(jammy) and drops support for python3.6(bionic), see changelog. Therefore depending on which version is present in the charm venv, we either lose support for jammy or bionic. The installed websockets version is, quite tightly, controlled by libjuju setup.py(current version 3.0.1). When the charm is built on python3.8(focal), websockets==7.0 is installed into the charm venv, which does not support python3.10. Causing the error. When the charm is built on python3.10(jammy), websockets==10 is installed, which does not support python3.6(bionic). Causing a similar error.

As of now, the charm-juju-backup-all builds on focal for running on bionic, focal and jammy. This version bundles websockets 7.0 which is not supported in jammy with Python 3.10.

A possible fix is to build on jammy (22.04) for running on jammy and the focal (20.04) build would be used for running on focal and bionic (18.04). This would ensure that the charm built on jammy has the supported websockets version to run on Python 3.10 shipped with jammy.

jneo8 commented 11 months ago

(by przemeklal) Is there any update on this? I ran into the same exact issue, also on Jammy, with exactly the same symptoms and errors in the logs.

jneo8 commented 11 months ago

(by aieri) Yes, the fix has been merged and is available in the edge channel (rev 44). I have now updated the bug status. The new release will be published to stable after the 23.07 release process is complete.