Skip to content

Commit "Pass _APINode.session down to children classes" seems to cause systemd-python module's systemd.journal to stop working #672

Description

@slimemold

I have been using and maintaining my python3 app that uses pylxd to manipulate lxc containers (mainly starting/stopping containers and adding and removing devices to these containers), and this app uses systemd-python to log messages into journald.

In case it's relevant, most of this logging (including the point of failure) is happening from within the context of python-daemon's DaemonContext.

At some point during a python modules upgrade to refresh my dependencies, I noticed that my app's messages at some point during its execution suddenly stop logging messages to journald. The app otherwise functions normally, but since logging stops working, it's very difficult to debug when something goes wrong.

I've seen this on various Ubuntu distros (20.04, 22.04, 24.04).

I eventually tracked it down to pylxd 2.3.1 being the last good version (pylxd 2.3.2 exhibits this issue for me).

I then pulled the pylxd repo and bisected between the two versions, and found that the first bad commit is:

9974257 is the first bad commit
commit 9974257
Author: Adam Collard adam.collard@canonical.com
Date: Tue Feb 14 09:52:17 2023 +0000

Pass _APINode.session down to children classes

Fixes #360

Allow callers to modify the session and have it persisted through the
API path traversal.

Signed-off-by: Adam Collard <adam.collard@canonical.com>

pylxd/client.py | 42 ++++++++++++++++++++++++++++--------------
pylxd/tests/test_client.py | 6 ++++++
2 files changed, 34 insertions(+), 14 deletions(-)

API endpoints are not my forte, but I tried to understand what's going on with this commit, and I don't see any fault in it. Nevertheless, there is something about it that, as a side effect, interacts with systemd.journal.

Anyone have any ideas as to why this could be happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions