[Yum-devel] [PATCH] Ignore lock held by zombie process. BZ 746004, 745281.

Zdeněk Pavlas zpavlas at redhat.com
Mon Oct 17 12:02:53 UTC 2011


Zombies may never run and touch locked data again,
so for all practical purposes, they don't exist.
---
 yum/__init__.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 1807d61..c3b5255 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1900,6 +1900,12 @@ class YumBase(depsolve.Depsolve):
                         msg = _('Unable to check if PID %s is active') % oldpid
                         raise Errors.LockError(errno.EPERM, msg, oldpid)
                 else:
+                    try: st = open("/proc/%d/stat" % oldpid).read().split()[2]
+                    except: st = None
+                    if st == 'Z':
+                        # The pid is a zombie.
+                        self._unlock(lockfile)
+                        continue
                     # Another copy seems to be running.
                     msg = _('Existing lock %s: another copy is running as pid %s.') % (lockfile, oldpid)
                     raise Errors.LockError(0, msg, oldpid)
-- 
1.7.4.4



More information about the Yum-devel mailing list