Bug 2307635

Summary: python daemon library can use a lot of memory on high ulimit systems (even causing OOMs)
Product: [Fedora] Fedora Reporter: Joseph Tate <jtate>
Component: python-daemonAssignee: Lumír Balhar <lbalhar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: infra-sig, lbalhar, xavier
Target Milestone: ---Keywords: RFE
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-daemon-3.1.0-1.fc42 python-daemon-3.1.0-1.fc39 python-daemon-3.1.0-1.fc41 python-daemon-3.1.0-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-04 09:53:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joseph Tate 2024-08-23 18:33:35 UTC
On a system with ulimit -n in the +1billion range (due to running in docker with no resource limits set), my system was churning and ooming every few minutes. A trace into the code showed that the version of python-daemon provided by the OS (2.3.2) was creating a 1billion+ member set on import.

The culprit is https://pagure.io/python-daemon/blob/80e389dbefdaa1ad38cd025ab25cf7d6be64f2d9/f/daemon/daemon.py#_867

This bug has been fixed in python-daemon 3.0 and later (released 2 years ago), but Fedora 39 through 41 and Rawhide still use 2.3.2 (as of 2024-08-23).

Reproducible: Always

Steps to Reproduce:
1. Set ulimit -Hn to some high number like 1billion (will probably need to be root)
2. run python
3. In the Python repl, `import daemon`
Actual Results:  
The process will consume all CPU and RAM until killed by the oom killer.

Expected Results:  
One would expect that importing daemon wouldn't consume large amounts of RAM.

To work around this bug, make sure you set reasonable ulimits for your application, or don't use system python-daemon.

Comment 2 Fedora Update System 2024-11-04 09:49:12 UTC
FEDORA-2024-e7908a7e8c (python-daemon-3.1.0-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-e7908a7e8c

Comment 3 Fedora Update System 2024-11-04 09:53:40 UTC
FEDORA-2024-e7908a7e8c (python-daemon-3.1.0-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2024-11-04 10:15:23 UTC
FEDORA-2024-bb8fd130e9 (python-daemon-3.1.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-bb8fd130e9

Comment 5 Fedora Update System 2024-11-04 10:15:44 UTC
FEDORA-2024-051a8f58e5 (python-daemon-3.1.0-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-051a8f58e5

Comment 6 Fedora Update System 2024-11-04 10:16:04 UTC
FEDORA-2024-34055104c0 (python-daemon-3.1.0-1.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-34055104c0

Comment 7 Fedora Update System 2024-11-05 04:11:58 UTC
FEDORA-2024-bb8fd130e9 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-bb8fd130e9`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-bb8fd130e9

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2024-11-05 04:45:47 UTC
FEDORA-2024-34055104c0 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-34055104c0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-34055104c0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2024-11-05 06:52:06 UTC
FEDORA-2024-051a8f58e5 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-051a8f58e5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-051a8f58e5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2024-11-06 02:44:43 UTC
FEDORA-2024-34055104c0 (python-daemon-3.1.0-1.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2024-11-06 03:52:43 UTC
FEDORA-2024-bb8fd130e9 (python-daemon-3.1.0-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2024-11-13 02:58:57 UTC
FEDORA-2024-051a8f58e5 (python-daemon-3.1.0-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.