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 1718953 - Layered slices are left in a "dead" state if slices are stopped that have child slices underneath
Summary: Layered slices are left in a "dead" state if slices are stopped that have chi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.6
Hardware: Unspecified
OS: Unspecified
urgent
medium
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 1729227 1729228
TreeView+ depends on / blocked
 
Reported: 2019-06-10 15:31 UTC by Kyle Walker
Modified: 2024-06-13 22:08 UTC (History)
11 users (show)

Fixed In Version: systemd-219-69.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1729227 1729228 (view as bug list)
Environment:
Last Closed: 2020-03-31 20:02:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1117 0 None None None 2020-03-31 20:03:05 UTC

Description Kyle Walker 2019-06-10 15:31:35 UTC
Description of problem:
 For nested slices, stopping of the parent results in the parent slice entering a "dead" state. Upstream releases result in the child and parent slices being removed without a "dead" state. 

Version-Release number of selected component (if applicable):
 systemd-219-62.el7_6.7.x86_64

How reproducible:
 Easily

Steps to Reproduce:
1. Start a few nested slices using "systemd-run"
    # systemd-run --slice first-second-third echo test

2. Verify that all are active
    # systemctl list-units --type slice --all first*

3. Stop the "first-second" slice
    # systemctl stop first-second.slice

4. Verify the slice states
    # systemctl list-units --type slice --all first*

Actual results:

    # systemd-run --slice first-second-third echo test
    Running as unit run-5416.service.

    # systemctl list-units --type slice --all first*
    UNIT                     LOAD   ACTIVE SUB    DESCRIPTION
    first-second-third.slice loaded active active first-second-third.slice
    first-second.slice       loaded active active first-second.slice
    first.slice              loaded active active first.slice

    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.

    3 loaded units listed.
    To show all installed unit files use 'systemctl list-unit-files'.

    # systemctl stop first-second.slice

    # systemctl list-units --type slice --all first*
    UNIT                     LOAD   ACTIVE   SUB    DESCRIPTION
    first-second-third.slice loaded active   active first-second-third.slice
    first-second.slice       loaded inactive dead   first-second.slice
    first.slice              loaded active   active first.slice

    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.

    3 loaded units listed.
    To show all installed unit files use 'systemctl list-unit-files'.

Expected results:

    # systemd-run --slice first-second-third.slice echo "test"
    Running as unit: run-rfa7d23674bad47259b4d31ea38911c15.service

    # systemctl list-units --type slice --all first*
    UNIT                     LOAD   ACTIVE SUB    DESCRIPTION                                                                                                                                                                                    
    first-second-third.slice loaded active active first-second-third.slice                                                                                                                                                                       
    first-second.slice       loaded active active first-second.slice                                                                                                                                                                             
    first.slice              loaded active active first.slice                                                                                                                                                                                        

    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.
    
    3 loaded units listed.
    To show all installed unit files use 'systemctl list-unit-files'.

    # systemctl stop first-second.slice

    # systemctl list-units --type slice --all first*
    UNIT        LOAD   ACTIVE SUB    DESCRIPTION                                                                                                                                                                                                 
    first.slice loaded active active first.slice                                                                                                                                                                                                 
    
    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.
    
    1 loaded units listed.
    To show all installed unit files use 'systemctl list-unit-files'.

Additional info:
 I initially suspected that the following commit was responsible:

  commit 8c8da0e0cb498245c765732cf9caa081a70c560f
  Author: Lennart Poettering <lennart>
  Date:   Tue Sep 29 13:06:28 2015 +0200

    core: add a "Requires=" dependency between units and the slices they are located in
    
    We place the processes we fork off in the cgroup anyway, and we probably
    shouldn't be able to get that far if we couldn't set up the slice due to
    resource problems or unmet conditions. Hence upgrade the dependency
    between units and the slices they are located in from Wants= to
    Requires=.

Test outcome with the above patch results in the 3rd generation slice being stopped, but the 2nd generation remains in the "dead" state:

    # systemctl list-units --type slice --all first*
    UNIT               LOAD   ACTIVE   SUB    DESCRIPTION
    first-second.slice loaded inactive dead   first-second.slice
    first.slice        loaded active   active first.slice

    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.

    2 loaded units listed.
    To show all installed unit files use 'systemctl list-unit-files'.


This did have the effect of stopping the child slice, but it still left the parent in the dead state. The failure condition here is needing to be addressed as OpenShift workloads will issue stop operations on slices without necessarily stopping the child slices. This is necessary to avoid a unit leakage condition that will _eventually_ result in E2BIG due to MANAGER_MAX_NAMES.

Comment 2 David Tardon 2019-06-11 16:40:29 UTC
Yeah. Units with cyclic references are not garbage collected properly. This was fixed by https://github.com/systemd/systemd/pull/8175 . It doesn't look too hard to backport, so I'll give it a try...

Comment 3 David Tardon 2019-06-17 08:25:07 UTC
PR: https://github.com/systemd-rhel/rhel-7/pull/21

Comment 4 David Tardon 2019-06-20 15:46:15 UTC
Testing rpms: http://people.redhat.com/dtardon/systemd/bz1718953-nested-slices/

Comment 5 Sam Mingo 2019-06-20 18:37:45 UTC
If we were to try these RPMs out, what would be the recommended way of installing them?

Comment 9 Lukáš Nykrýn 2019-07-11 13:29:39 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-7/pull/21 -> post

Comment 12 Lukáš Nykrýn 2019-07-24 13:26:58 UTC
fix merged to github rhel-7.6 branch -> https://github.com/systemd-rhel/rhel-7/pull/31 -> post

Comment 17 errata-xmlrpc 2020-03-31 20:02:28 UTC
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, 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-2020:1117


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