"change-packages" fails on PackageTask initialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Client |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
We have a standalone landscape server, that hands out a package "landscape-
On the server this activity is stuck in the "in progress" status.
On the client these logmessages can be found in syslog:
```
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:12 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
Oct 26 22:51:13 hostnamehere landscape-
```
Basically the PackageTask instance is unable to get the row that was found by get_next_task.
Additional information:
Landscape Client Version: 18.01-0ubuntu13
Operating System: Ubuntu 22.04.1 LTS
Kernel: Linux 5.15.0-52-generic
Architecture: x86-64
Hardware Vendor: Dell Inc.
Hardware Model: Latitude 5401
/ Filesystem is btrfs
I use suspend and hibernate via systemctl.
Workaround:
A restart of the landscape-
description: | updated |
Changed in landscape-client: | |
status: | New → In Progress |
status: | In Progress → Fix Committed |
The problem seems to be produced by a double SELECT:
- get_next_task() execute a SELECT which is valid and returns a valid ROW
- Then get_next_task() creates an instance from PackageTask, which executes a second SELECT to bring some fields from the database.
I must mention that get_next_task() is inside a transaction by the @with_cursor decorator, which shouldn't fail.
This solution optimizes the number of queries sent to the database and prevents this exception from happening.
A PR that removed the unnecessary SELECT has been proposed: /github. com/CanonicalLt d/landscape- client/ pull/146
https:/