[SRU] Rewinding cache triggers obsolete adjustments consuming a lot of CPU
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
unattended-upgrades (Debian) |
Fix Released
|
Unknown
|
|||
unattended-upgrades (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Focal |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
* Unattended-upgrades consumes excessive amount of CPU when rewinding cache trying to mark packages to upgrade or install even when they are already marked to be upgraded or installed. This can be triggered by packages held back.
[Test Case]
* Run test_rewind.py:
-Fixed output:
$ python3 test_rewind.py
INFO:root:Allowed origins are: o=Ubuntu,
INFO:root:Initial blacklist: ant-doc
INFO:root:Initial whitelist (not strict):
DEBUG:root:Marking not allowed <apt_pkg.
DEBUG:root:Applying pinning: PkgFilePin(id=0, priority=-32768)
DEBUG:root:Applying pin -32768 to package_file: <apt_pkg.
DEBUG:root:Applying pinning: PkgPin(
DEBUG:root:
DEBUG:root:
DEBUG:root:
DEBUG:root:falling back to adjusting test2-package's dependencies
DEBUG:root:falling back to adjusting z-package's dependencies
DEBUG:root:sanity check failed for: set() : no package is selected to be upgraded or installed
.
-------
Ran 1 test in 0.022s
OK
- Not fixed output:
$ python3 test_rewind.py
INFO:root:Allowed origins are: o=Ubuntu,
INFO:root:Initial blacklist: ant-doc
INFO:root:Initial whitelist (not strict):
DEBUG:root:Marking not allowed <apt_pkg.
DEBUG:root:Applying pinning: PkgFilePin(id=0, priority=-32768)
DEBUG:root:Applying pin -32768 to package_file: <apt_pkg.
DEBUG:root:Applying pinning: PkgPin(
DEBUG:root:
DEBUG:root:
DEBUG:root:
DEBUG:root:falling back to adjusting test2-package's dependencies
DEBUG:root:falling back to adjusting z-package's dependencies
DEBUG:root:sanity check failed for: set() : no package is selected to be upgraded or installed
DEBUG:root:falling back to adjusting test-package's dependencies
DEBUG:root:falling back to adjusting test2-package's dependencies
DEBUG:root:falling back to adjusting test3-package's dependencies
DEBUG:root:falling back to adjusting test-package's dependencies
DEBUG:root:falling back to adjusting test2-package's dependencies
DEBUG:root:falling back to adjusting test3-package's dependencies
.
-------
Ran 1 test in 0.024s
(Note the extra "DEBUG:root:falling back to adjusting" ... lines)
[Regression Potential]
* Minimal. The very small change fixes how call_checked() verifies that the package to be upgrades/installed is indeed marked to either being installed or upgraded.
In the worst case, if call_checked() erroneously returns success for a package as a result of a regression, unattended-upgrades does not fall back to adjusting packages to make marking successful. Later unattended-upgrades finds out that the package could not be marked and should be treated as kept back.
Changed in unattended-upgrades (Debian): | |
status: | Unknown → Confirmed |
description: | updated |
Changed in unattended-upgrades (Debian): | |
status: | Confirmed → Fix Released |
information type: | Public → Public Security |
information type: | Public Security → Public |
This bug was fixed in the package unattended-upgrades - 2.4
---------------
unattended-upgrades (2.4) unstable; urgency=medium
* Fix checking if an upgrade/install marking succeeded.
The false negative result caused unattended-upgrades trying to apply
workarounds to upgrade/install the package using excessive amount of CPU
time. (Closes: #958883) (LP: #1877769)
* Treat "-" and ":" as valid parts of both Python and POSIX regular
expressions
-- Balint Reczey <email address hidden> Sat, 09 May 2020 16:14:14 +0200