Hide Forgot
Description of problem: Warning during reading file in Python3. Problem is construction of code. Missing call to close file. For example: cert = open(cert_path).read() ... f = open(cert_path) cert = f.read() f.close() https://docs.python.org/3/whatsnew/3.2.html A ResourceWarning is also issued when a file object is destroyed without having been explicitly closed. While the deallocator for such object ensures it closes the underlying operating system resource (usually, a file descriptor), the delay in deallocating the object could produce various issues,... Version-Release number of selected component (if applicable): osad-5.11.74-1.fc24.noarch How reproducible: always Steps to Reproduce: 1. install osad and run it Additional info: >> /usr/sbin/osad --pid-file /var/run/osad.pid -N -v 2016-11-15 14:11:48 jabber_lib.__init__: /usr/share/rhn/osad/jabber_lib.py:358: ResourceWarning: unclosed file <_io.TextIOWrapper name='/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT' mode='r' encoding='ANSI_X3.4-1968'> cert = open(cert_path).read() 2016-11-15 14:11:49 jabber_lib.setup_connection: Connected to jabber server elisha.brq.redhat.com /usr/share/rhn/osad/osad.py:209: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/sysconfig/rhn/systemid' mode='r' encoding='ANSI_X3.4-1968'> self._systemid = open(self._systemid_file).read() /usr/share/rhn/osad/osad.py:246: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/sysconfig/rhn/systemid' mode='r' encoding='ANSI_X3.4-1968'> systemid = open(self._systemid_file).read() 2016-11-15 14:11:49 jabber_lib.process_forever: /usr/share/rhn/osad/osad.py:267: ResourceWarning: unclosed file <_io.TextIOWrapper name='/etc/sysconfig/rhn/systemid' mode='r' encoding='ANSI_X3.4-1968'> systemid = open(self._systemid_file).read()
This issue seems to be fixed in current Spacewalk 2.9 client. If you are still able to reproduce it please update the reproducer and reopen it. Thanks. # /usr/sbin/osad --pid-file /var/run/osad.pid -N -v 2019-07-12 11:37:36 jabber_lib.__init__: 2019-07-12 11:37:37 jabber_lib.setup_connection: Connected to jabber server spacewalk.exemple.com 2019-07-12 11:37:38 jabber_lib.process_forever: 2019-07-12 11:37:38 osad_client.run_rhn_check_async: executed /usr/sbin/rhn_check with pid 77