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.
Bug 1828759 - "systemctl list-unit-files" kills the system usability
Summary: "systemctl list-unit-files" kills the system usability
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.1
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 8.0
Assignee: Michal Sekletar
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-28 10:19 UTC by Renaud Métrich
Modified: 2021-05-11 17:20 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-06 10:32:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2020-04-28 10:19:38 UTC
This bug was initially created as a copy of Bug #1828758

I am copying this bug because: 

Also applies.


Description of problem:

On large systems with many users connecting to it (e.g. ~1000 users, but can be reproduced with less users, depending on how many sessions they use), a simple "systemctl list-unit-files" query freezes systemd for an enormous amount of time (>= 50 seconds), preventing regular users to use the system:
- they cannot connect to it in less than 25 seconds
- no event is handled by systemd (clean ups, etc)

The reason behind this is systemd not off-loading the "ListUnitFiles" query which is heavily I/O consuming (it reads *all* unit configuration files).

Version-Release number of selected component (if applicable):

systemd-219 but also systemd-239 (RHEL8) and later


How reproducible:

Always


Steps to Reproduce:
1. Create 1000 users in a VM with 8GB of memory / 4 CPUs

  # for i in $(seq 1 1000); do user="user$(printf "%04d" $i)"; echo $user; useradd $user; echo "user" | passwd --stdin $user; done

2. Copy root's key to user0001's authorized_keys

  # ssh-copy-id user0001@localhost
  Password: "user"

3. Create all other authorized_keys files

  # for i in $(seq 2 1000); do user="user$(printf "%04d" $i)"; cp -r user0001/.ssh $user; chown -R $user:$user $user/.ssh; done

4. Spawn 1000 ssh sessions

  # for i in $(seq 1 1000); do user="user$(printf "%04d" $i)"; echo "$user"; ssh -f $user@localhost 'sleep 3600'; done

5. Execute "list-unit-files"

  # systemctl list-unit-files --no-pager
  Failed to list unit files: Connection timed out


Actual results:

systemd not functional ~50 seconds!

Expected results:

systemd still doing its usual job


Additional info:

The "ListUnitFiles" is only an example, we suppose that there are other operations (DBus or others) that affect systemd as well, but so far we weren't able to find those yet.

Comment 1 Michal Sekletar 2020-06-30 10:30:05 UTC
I've tried to speed up list-unit-files operation by introducing additional symlink cache. I have PoC patch ready and initial measurements show speedup by roughly 30-40%.

Comment 8 Renaud Métrich 2021-05-06 10:32:44 UTC
The issue seems completely gone on RHEL8.3 (systemd-239-41.el8_3.2.x86_64), closing this.

Comment 9 Nick Stielau 2021-05-06 20:36:58 UTC
I don't see a backport clone.  Can we get this backported to RHEL 8.2?


Note You need to log in before you can comment on or make changes to this bug.