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.

Bug 2064727

Summary: setroubleshootd seems to leak memory
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: setroubleshootAssignee: Vit Mojzis <vmojzis>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: low    
Version: 8.5CC: bsingh, lvrabec, mmalik, plautrba, vmojzis, zpytela
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: setroubleshoot-3.3.26-4.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 10:01:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2022-03-16 12:44:24 UTC
Description of problem:

On systems that constantly fire AVCs, we can see setroubleshootd taking more and more memory with time.
It's possible it's not a real memory leak but just enqueuing the AVC received by sedispatch for later processing (since setroubleshootd cannot handle AVCs as fast as sedispatch submits them), but on the long run, this memory consumption is a real issue.

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

setroubleshoot-server-3.3.24-4.el8.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Create a "AVC spawner", for example using the following /usr/local/bin/foobar script labeled intentionally with "logrotate_exec_t"

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
#!/bin/sh

echo "$(basename $0): $(id -Z)"
while :; do
	semanage fcontext -a -t http_config_t /tmp/foobar0001
done
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# chmod +x /usr/local/bin/foobar
# chcon -t logrotate_exec_t /usr/local/bin/foobar
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Create AVCs constantly 

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# for i in $(seq 1 5); do; systemd-run --unit=foobar$i.service /usr/local/bin/foobar; done
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

3. Monitor setroubleshootd memory consumption

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# while :; do date; ps aux | grep setroubleshoot | grep -v grep; echo; sleep 10; done
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Actual results:

initial:
setroub+   12979  8.1  7.3 547492 136712 ?       Sl   10:07   0:12 /usr/libexec/platform-python -Es /usr/sbin/setroubleshootd -f
setroub+   12979  8.0  7.3 547492 136712 ?       Sl   10:07   0:12 /usr/libexec/platform-python -Es /usr/sbin/setroubleshootd -f
 :
after 1 hour:
setroub+   12979  7.3 12.0 634976 224156 ?       Sl   10:07   5:14 /usr/libexec/platform-python -Es /usr/sbin/setroubleshootd -f
setroub+   12979  7.3 12.0 635232 224408 ?       Sl   10:07   5:15 /usr/libexec/platform-python -Es /usr/sbin/setroubleshootd -f
setroub+   12979  7.3 12.0 635232 224588 ?       Sl   10:07   5:16 /usr/libexec/platform-python -Es /usr/sbin/setroubleshootd -f
 :

Expected results:


Additional info:

Comment 19 errata-xmlrpc 2022-11-08 10:01:30 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 (setroubleshoot 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-2022:7642