Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 912766

Summary: Syncing multiple repos with the same distributions causes a race condition (pulpv1)
Product: [Retired] Pulp Reporter: Justin Sherrill <jsherril>
Component: rpm-supportAssignee: pulp-bugs
Status: CLOSED WONTFIX QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.1.0CC: aweiteka, rbarlow, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-03 15:29:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pulp.log with errors (bziped for size) none

Description Justin Sherrill 2013-02-19 15:47:55 UTC
Description of problem:

When syncing many repos at the same time, if multiple repos contain distributions (and possibly the same distribution), a race condition sometimes happen which results in one or more of the sync failing.  (Note this isn't reproducible 100% of the time).


The original katello bug this spawned from: 

https://bugzilla.redhat.com/show_bug.cgi?id=887027

Comment 1 Justin Sherrill 2013-02-19 15:50:14 UTC
relevant tracebacks:


Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 418, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo_sync.py", line 283, in _sync
    progress_callback, synchronizer, max_speed, threads)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo_sync.py", line 379, in fetch_content
    synchronizer.add_distribution_from_dir(repo_dir, repo_id, skip_dict)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/synchronizers.py", line 347, in add_distribution_from_dir
    self._process_repo_images(dir, repo)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/synchronizers.py", line 484, in _process_repo_images
    os.mkdir(distro_path)
OSError: [Errno 17] File exists: '/var/lib/pulp/published/ks'


upon trying to re-sync:



Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pulp/server/tasking/task.py", line 418, in run
    result = self.callable(*self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo_sync.py", line 283, in _sync
    progress_callback, synchronizer, max_speed, threads)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/repo_sync.py", line 372, in fetch_content
    progress_callback, max_speed, threads)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/synchronizers.py", line 164, in sync
    max_speed=max_speed, threads=threads)
  File "/usr/lib/python2.6/site-packages/pulp/server/api/synchronizers.py", line 811, in remote
    verify_options=verify_options)
  File "/usr/lib/python2.6/site-packages/grinder/RepoFetch.py", line 204, in fetchYumRepo
    self.setupDistroInfo()
  File "/usr/lib/python2.6/site-packages/grinder/RepoFetch.py", line 154, in setupDistroInfo
    distro_items = info.prepareTrees(self.repoFetch)
  File "/usr/lib/python2.6/site-packages/grinder/DistroInfo.py", line 42, in prepareTrees
    return self.__prepareTrees(tree_manifest)
  File "/usr/lib/python2.6/site-packages/grinder/DistroInfo.py", line 126, in __prepareTrees
    os.makedirs(info['pkgpath'])
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/var/lib/pulp/distributions/ks-Red Hat Enterprise Linux-Server-6.4-x86_64'

Comment 2 Justin Sherrill 2013-02-19 15:51:25 UTC
Discussion with prad:

jsherrill | anyone have a moment for a pulpv1 sync issue?                                                                      │
jsherrill | bugzilla is here https://bugzilla.redhat.com/show_bug.cgi?id=887027,  but basically when we sync multiple repos at │
          | the same time, i think we might be hitting a race condition with regard to distributions                           │
jsherrill | jdob: prad-  ^                                                                                                     │
    prad- | jsherrill, looking                                                                                                 │
jsherrill | prad-: thanks!                                                                                                     │
jsherrill | prad-: it was filed a katello bug, but i've put the relevant pulp tracebacks at the bottom                         │
    prad- | hmm looks like a race condition to me where, multiple threads are trying to create that dir/symlink                │
jsherrill | right, that's kinda what i was thinking                                                                            │
    prad- | we might need some locking around it looks like                                                                    │
jsherrill | prad-: would that be a large/difficult effort to do?                                                               │
    prad- | jsherrill, shouldnt be, as we do something similar in other areas, so we should be able to reuse some of it        │

Comment 3 Justin Sherrill 2013-02-19 15:54:56 UTC
Created attachment 699503 [details]
pulp.log with errors (bziped for size)

Comment 4 Randy Barlow 2014-01-03 15:29:56 UTC
I believe we are no longer supporting Pulp v1.