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 1781364 - dnf.Base.close() does not close hawkey.log filedescriptor
Summary: dnf.Base.close() does not close hawkey.log filedescriptor
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: dnf
Version: 7.7
Hardware: All
OS: Linux
high
low
Target Milestone: rc
: ---
Assignee: Marek Blaha
QA Contact: Eva Mrakova
URL:
Whiteboard:
Depends On: 1594016
Blocks: 1781360
TreeView+ depends on / blocked
 
Reported: 2019-12-09 21:03 UTC by Mike McLean
Modified: 2020-09-30 07:45 UTC (History)
8 users (show)

Fixed In Version: libdnf-0.22.5-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1594016
Environment:
Last Closed: 2020-09-30 07:44:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4084 0 None None None 2020-09-30 07:45:01 UTC

Description Mike McLean 2019-12-09 21:03:32 UTC
+++ This bug was initially created as a clone of Bug #1594016 +++

Description of problem:

Not sure if this is a dnf issue or father down, but:

#!/usr/bin/python3
import dnf
import psutil

proc = psutil.Process()
base = dnf.Base()
base.conf.assumeyes = True
base.conf.read()
for i in [1, 2, 3]:
    base.fill_sack(load_system_repo='auto')
    base.close()
    print(proc.open_files())


produces:

[popenfile(path='/var/lib/sss/mc/passwd', fd=3, position=0, mode='r', flags=557056), popenfile(path='/var/lib/sss/mc/group', fd=5, position=0, mode='r', flags=557056), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=6, position=4834, mode='a', flags=33793)]
[popenfile(path='/var/lib/sss/mc/passwd', fd=3, position=0, mode='r', flags=557056), popenfile(path='/var/lib/sss/mc/group', fd=5, position=0, mode='r', flags=557056), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=6, position=4880, mode='a', flags=33793), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=7, position=4968, mode='a', flags=33793)]
[popenfile(path='/var/lib/sss/mc/passwd', fd=3, position=0, mode='r', flags=557056), popenfile(path='/var/lib/sss/mc/group', fd=5, position=0, mode='r', flags=557056), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=6, position=4880, mode='a', flags=33793), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=7, position=5014, mode='a', flags=33793), popenfile(path='/var/tmp/dnf-orion-admin-75jop0p2/hawkey.log', fd=8, position=5102, mode='a', flags=33793)]

Note the multiple open files of hawkey.log.

Version-Release number of selected component (if applicable):
python3-dnf-2.7.5-12.fc28.noarch

Related see https://github.com/ansible/ansible/pull/41810

--- Additional comment from David Wilson on 2018-06-22 03:33:52 UTC ---

Hi there,

This problem seems to be due to 'self._sack = None' in 'def reset()' being insufficient to clear out the last reference to the Sack, causing tp_dealloc() to call hy_sack_free() and subsequently close the file descriptor.

Triggering a manual 'gc.collection()' suggests the problem is also unrelated to a reference cycle within the graph of the Sack object itself, unless it has a missing or buggy tp_traverse implementation.

Please expose an explicit close() method on the Sack object, the existing API is unsafe as it conflates memory management and resource finalization, which always leads to fragile and surprising results

Related digging: https://github.com/dw/mitogen/issues/280#issuecomment-399307248

--- Additional comment from Ben Cotton on 2019-05-02 20:47:28 UTC ---

This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

--- Additional comment from Orion Poplawski on 2019-05-06 17:42:41 UTC ---

Still present with python3-dnf-4.2.5-1.fc29.noarch

--- Additional comment from Jaroslav Mracek on 2019-09-10 16:47:56 UTC ---

I created a patch: https://github.com/rpm-software-management/libdnf/pull/792

--- Additional comment from Jaroslav Mracek on 2019-10-19 15:39:08 UTC ---

Fixed in Fedora 30 - dnf-4.2.11

Comment 9 errata-xmlrpc 2020-09-30 07:44:56 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 (libdnf bug fix 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-2020:4084


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