Closed honghan-wong closed 1 month ago
Thanks for the report! I'm doing some investigating now.
The dependency chain looks like: charm-juju-backup-all
-> jujubackupall == v1.1.0
(direct from github) -> juju
-> macaroonbakery
-> protobuf >= 3.20.0
.
So I guess the root cause is macaroonbakery not being compatible with protobuf 4.x. I'll start looking into what will be required to fix this upstream. :)
However if it is not, we need to think of a way to handle old protobuf version, like running charm in venv.
Charmcraft should be shipping all the dependencies with the charm, so a quick workaround may be to pin protobuf==3.20.1 in the charm requirements.
... although this is weird:
File "/var/lib/juju/agents/unit-juju-backup-all-0/charm/venv/juju/client/connector.py", line 9, in <module>
import macaroonbakery.httpbakery as httpbakery
File "/usr/lib/python3/dist-packages/macaroonbakery/httpbakery/__init__.py", line 3, in <module>
from ._client import (
It's using macaroonbakery from the system, even though it's included with the charm. :thinking:
@honghan-wong could you add more details please to help with reproducing this? Charm revision / channel, base, when was this traceback seen?
Hi Samuel, the charm we are using is
juju-backup-all latest/edge 14
OS Ubuntu 22.04.4 LTS
kernel 5.15.0-112-generic
It was first seen when we are doing a handover, happened around Jun 28.
The reproduce step is just deploy the charm on a server, and the charm will goes into the error state.
I discovered that the auto_backup script will favour importing packages from the system libraries, instead of from the charm. This means that if there are incompatible versions installed system-wide, it will use those and crash. I opened https://github.com/canonical/charm-juju-backup-all/pull/46 to fix the issue.
However, I'm not sure about the root cause of this particular issue. It's not clear why python3-macaroonbakery and python3-protobuf are installed systemwide with apt. Also I couldn't reproduce the issue with latest/edge. Note also that protobuf 5.26.1 is shipped with the charm env.
Confirming that #46 fixed the issue. :) Thanks for the report and the help confirming the fix @honghan-wong !
Hi,
We have an issue where if the os is running on a later version with python and pip installed with
protobuf
version higher than3.20.x
, theauto_backup.py
will throw an error like below:This is due to a change in protobuf release, link.
Downgrading python protobuf lib is a workaround to this.
pip install -Iv protobuf==3.20.1
We are not sure the ideal way to handle the python protobuf lib version to not breaking older version. If the new protoc is backward compatible then we should be good to just compile the charm with a later protobuf version. However if it is not, we need to think of a way to handle old protobuf version, like running charm in venv.