Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
dangling device units are not unloaded properly, which leads to increased memory usage by subsequent calls to systemctl.
Version-Release number of selected component (if applicable):
systemd-239-58.el8_6.4
systemd-250-6.el9
How reproducible:
Steps to Reproduce:
1.$ sudo lvcreate -n test-a-1 -L1G test
Logical volume "test-a-1" created.
2.$ systemctl list-units --all 'dev-disk-by\x2did-dm*'
UNIT LOAD ACTIVE SUB DESCRIPTION >
dev-disk-by\x2did-dm\x2dname\x2dtest\x2dtest\x2d\x2da\x2d\x2d1.device loaded active plugged /dev/disk/by-id/dm-name-test-test--a--1
dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dUOSUxz2ZQYd27F1vpz3bAZFukcNK3aQeKgxkfRkc06BhYHctCHcIUhMgQEW1dlIF.device loaded active plugged /dev/disk/by-id/dm-uuid-LVM-UOSUxz2ZQYd27F1vpz3bAZFukcNK3aQeKgxkfRkc06BhYHc>
3.$ sudo lvrename /dev/test/test-a-1 test-a-2
Renamed "test-a-1" to "test-a-2" in volume group "test"
4.$ systemctl list-units --all 'dev-disk-by\x2did-dm*'
UNIT LOAD ACTIVE SUB DESCRIPTION >
dev-disk-by\x2did-dm\x2dname\x2dtest\x2dtest\x2d\x2da\x2d\x2d1.device loaded active plugged /dev/disk/by-id/dm-name-test-test--a--1
dev-disk-by\x2did-dm\x2dname\x2dtest\x2dtest\x2d\x2da\x2d\x2d2.device loaded active plugged /dev/disk/by-id/dm-name-test-test--a--2
dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dUOSUxz2ZQYd27F1vpz3bAZFukcNK3aQeKgxkfRkc06BhYHctCHcIUhMgQEW1dlIF.device loaded active plugged /dev/disk/by-id/dm-uuid-LVM-UOSUxz2ZQYd27F1vpz3bAZFukcNK3aQeKgxkfRkc06BhYHc>
Actual results:
Currently systemd will create new device units for any new paths appearing in devlinks in a UDEV change event, but will not remove previously-created device units for paths which are no longer present in devlinks. This leaves device units for non-existent paths hanging around until the parent device is removed.
Further in RHEL-8 systemd if a daemon-reload is issued before the parent device unit is removed, the stale devlinks units lose their association with the parent device (through matching syspath) during device enumeration because the paths no longer exist, leaving them hanging around for ever (until rebooting).
Expected results:
Systemd should remove stale devlinks device units while dispatching UDEV "change" events for the parent device (e.g. when renaming an LVM Logical Volume).
Additional info:
Impacts RHEL-8 the most as systemctl enumerates device units when running - causing ever increasing use of memory.
Similar on RHEL-9 but can be cleared by daemon-reload.
relevant PRs for the fixes upstream are
https://github.com/systemd/systemd/pull/16968, https://github.com/systemd/systemd/pull/24522
and https://github.com/systemd/systemd-stable/pull/203
I'd expect such device renames and removals should be pretty rare in production, hence the impact of this should be low. Code-wise, the fix hasn't even been merged upstream yet (although it seems to be on the track). I think we could consider this for RHEL-9 (later, after v. 252 with the fix has been released and has got some real-life testing), but backport to RHEL-8 would be non-trivial and IMHO not worth the risk.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2023:2531