Description of problem: When yum fetches repo data from the Satellite, the following error messages appear in the /var/log/httpd/error_log: Exception exceptions.ValueError: 'I/O operation on closed file' in <bound method File.__del__ of <rhn.transports.File instance at 0xb765cacc>> ignored Exception exceptions.ValueError: 'I/O operation on closed file' in <bound method File.__del__ of <rhn.transports.File instance at 0xb75b486c>> ignored Exception exceptions.ValueError: 'I/O operation on closed file' in <bound method File.__del__ of <rhn.transports.File instance at 0xb765c9ac>> ignored Version-Release number of selected component (if applicable): Satellite 5.0.0, I believe I've already seen it on 4.2. How reproducible: Deterministic. Steps to Reproduce: 1. Run yum check-update. 2. Watch the error_log. Actual results: The error message about 'I/O operation on closed file'. Expected results: No error message. Additional info: The initial thought was that this error is somehow related to bug 247156. It does not seem to be but as I've spent quite some tome investigating the code, I have a fix in place. That's why I'm putting this in as an exception for sat-5.0.1.
Here's the result of the investigation: The Repository.repodata method in /usr/share/rhn/server/rhnRepository.py calls output = rpclib.File(output, name=file_name) The rpclib.File is the same as transports.File, and the output parameter passed to the File constructor is of the type common.rhnCache.ReadLockedFile. The transports.File objects is then processed through apacheRequest's response and response_file, and response_file calls response.close() And since the transports.File's constructor did self.close = file_obj.close the ReadLockedFile's close is directly called. And the close is called again in transports.File's desctructor.
We can handle the problem at the rhnCache's level, by allowing multiple calls to the close method: Index: rhnCache.py =================================================================== --- rhnCache.py (revision 118530) +++ rhnCache.py (working copy) @@ -160,11 +160,12 @@ self.closed = False def close(self): - self.close_fd() + if not self.closed: + self.close_fd() - _unlock(self.fd.fileno()) - self.fd.close() - self.closed = True + _unlock(self.fd.fileno()) + self.fd.close() + self.closed = True # def __del__(self): # if not self.closed: Another possibility is to get rid of the self.close = file_obj.close in transports.File, make close a proper method there, and set the flag that the close was called in transports.File.
Fix committed to SVN, branch RELEASE-5.0, revision 118566, and trunk, revision 118567.
Moving ON_QA because: Satellite 5.0.1-1 and Proxy 5.0.1-1 are now available on webqa hosted channels. Satellite 5.0.1-1 ISOs are now available.
QA Verified - running 'yum check-update' on a RHEL5 system against a 501 satellite results in no errors appearing in /var/log/httpd/error_log
RELEASE_PENDING
Removed Bug 249387 blocks bug 437059.