Repository :
http://git.fedorahosted.org/cgit/
On branch : master
---------------------------------------------------------------
commit 61cf0a47c0f00bbd4419174441763ec46a8a1566
Author: Matt Domsch <matt(a)domsch.com>
Date: Tue Jan 28 18:31:39 2014 -0600
handle disappearing HostCategoryDirs during report_mirror checkin
The crawler could run in parallel and delete these while we're
looking at them, leading to a traceback. This at least limits the
use-after-free induced failures.
https://fedorahosted.org/mirrormanager/ticket/48
---------------------------------------------------------------
server/mirrormanager/model.py | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/server/mirrormanager/model.py b/server/mirrormanager/model.py
index 8ea815e..2484a8a 100644
--- a/server/mirrormanager/model.py
+++ b/server/mirrormanager/model.py
@@ -291,15 +291,22 @@ class Host(SQLObject):
dname = hc.category.topdir.name
# Don't create an entry for a directory the database
doesn't know about
+ # and if a crawler created it so we hit a unique violation, then
we don't have to
try:
- dir = Directory.byName(dname)
- hcdir = HostCategoryDir(host_category=hc, path=d,
directory=dir)
+ directory = Directory.byName(dname)
+ hcdir = HostCategoryDir(host_category=hc, path=d,
directory=directory)
added += 1
except:
pass
- for d in HostCategoryDir.selectBy(host_category=hc):
- if d.path not in config[c]['dirtree'].keys():
- d.destroySelf()
+ for hcdir in hc.dirs:
+ # handle disappearing hcdirs, deleted by other processes
+ try:
+ hcdirpath = hcdir.path
+ except: continue
+ if hcdirpath not in config[c]['dirtree'].keys():
+ try:
+ hcdir.destroySelf()
+ except: pass
deleted += 1
message += "Category %s directories updated: %s added: %s deleted
%s\n" % (category.name, marked_up2date, added, deleted)