Hide Forgot
Description of problem: When "/usr/bin/yum -y --downloadonly update" is called, and there are packages to download, the process almost always leaves behind /var/run/yum.pid and rpmdb lockfiles. The reason for this appears to be that yum calls sys.exit in this scenario, and sys.exit does not reliably trigger the __del__ method for the YumBase object, which is where all the unlocking/cleanup happen. Relevant code from upstream, where this problem likely still exists: sys,exit happens here: http://yum.baseurl.org/gitweb?p=yum.git;a=blob;f=yum/__init__.py;h=84bea3eba2cf464f29666affb80ce658fc8fc074;hb=HEAD#l2627 __del__ method is here: http://yum.baseurl.org/gitweb?p=yum.git;a=blob;f=yum/__init__.py;h=84bea3eba2cf464f29666affb80ce658fc8fc074;hb=HEAD#l235 Version-Release number of selected component (if applicable): yum-3.2.29-69.el6.noarch How reproducible: Almost always Steps to Reproduce: 1. Log into a system for which there will be updates to download 2. /usr/bin/yum -y --downloadonly update 3. ls /var/run/yum.pid /var/lib/rpm/__* Actual results: yum.pid and rpmdb lockfiles are present Expected results: lock files should be removed prior to the yum process exiting.
One update on this: I realized that I may be wrong about the current function/purpose of the /var/lib/rpm/__db* files. I was under the impression that those were lock files that would block subsequent transactions, but that does not seem to be the case in further tests. Also, it seems that while calling self.closeRpmDB() does close those filehandles, it doesn't actually remove the files. Adding self.doUnlock() prior to the sys.exit definitely works to remove the PID file, though.
It looks like upstream code closes these database well before the exit. It appears to have been added in this commit: http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=05666dc9295fb433d1b081068dbe74e535cfc228
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, 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://rhn.redhat.com/errata/RHBA-2017-0702.html