Bug 1346816 - publishing content view with many repos sharing same parent dir might raise "mkdir(name, mode)\nOSError: [Errno 17] File exists:" for the parent dir
Summary: publishing content view with many repos sharing same parent dir might raise "...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.1.8
Hardware: All
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks: 1379384 1417116
TreeView+ depends on / blocked
 
Reported: 2016-06-15 11:46 UTC by Pavel Moravec
Modified: 2021-04-06 17:57 UTC (History)
20 users (show)

Fixed In Version: pulp-2.8.7.6-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1379384 1417116 (view as bug list)
Environment:
Last Closed: 2017-03-06 08:27:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 2047 0 Normal CLOSED - CURRENTRELEASE directory creation race condition during publish 2016-09-19 21:31:41 UTC
Red Hat Product Errata RHBA-2017:0447 0 normal SHIPPED_LIVE Satellite 6.2.8 Async Bug Release 2017-03-06 13:23:41 UTC

Comment 4 Pavel Moravec 2016-06-27 16:48:02 UTC
Reproducer (little bit artificial but just to trigger proper race condition):

0) in publish_step.py around 770, artificially add "sleep(2)" just to ensure proper thread interleaving occurs:

            _LOG.info('bz1346816: create dir? %s, loc=%s' % (publish_dir_parent, publish_location))
            if not os.path.exists(publish_dir_parent):
                _LOG.info('bz1346816: new create dir %s, loc=%s' % (publish_dir_parent, publish_location))
                time.sleep(2)
                os.makedirs(publish_dir_parent, 0750)
                _LOG.info('bz1346816: created dir %s, loc=%s' % (publish_dir_parent, publish_location))


1) Have a Sat6 custom product with 2 dummy custom repos (2 is enough, in fact)

2) Publish a content view having the 2 custom repos contained

3) Check Actions::Katello::Repository::MetadataGenerate task in WebUI and /var/log/messages


Current results:
- one such task for one of the two repos fails with "File exists" error
- /var/log/messages has the same error


Expected results:
- no such either error


Trivial patch is adding the try / except block.

Michael, could you pls. triage in upstream?

Comment 5 Edu Alcaniz 2016-07-07 06:22:53 UTC
Morning, could you update this BZ please.

Comment 6 Pavel Moravec 2016-08-16 07:52:09 UTC
Some progress made? We have a customer hitting this BZ that ended up due to this bug in many repos being empty..

Comment 7 pulp-infra@redhat.com 2016-08-26 15:30:32 UTC
The Pulp upstream bug status is at ASSIGNED. Updating the external tracker on this bug.

Comment 8 pulp-infra@redhat.com 2016-08-26 15:30:35 UTC
The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug.

Comment 9 pulp-infra@redhat.com 2016-08-26 20:00:31 UTC
The Pulp upstream bug status is at POST. Updating the external tracker on this bug.

Comment 10 pulp-infra@redhat.com 2016-08-30 21:30:31 UTC
The Pulp upstream bug status is at MODIFIED. Updating the external tracker on this bug.

Comment 11 Michal Rdest 2016-09-05 11:51:38 UTC
Dear team, are there any updates on the bug please?
Could someone take ownership?
We've got 2 of our largest customer affected and escalating this.
Thank you in advance for response.

Comment 14 pulp-infra@redhat.com 2016-09-13 21:32:01 UTC
The Pulp upstream bug status is at ON_QA. Updating the external tracker on this bug.

Comment 15 pulp-infra@redhat.com 2016-09-19 20:31:20 UTC
The Pulp upstream bug status is at VERIFIED. Updating the external tracker on this bug.

Comment 16 pulp-infra@redhat.com 2016-09-19 21:31:42 UTC
The Pulp upstream bug status is at CLOSED - CURRENTRELEASE. Updating the external tracker on this bug.

Comment 17 Edu Alcaniz 2016-09-26 07:31:56 UTC
Hi, after check that maybe it will be a new Satellite version 6.1.z, is it possible to include it in the next version 6.1.10 or 6.1.11?

Comment 20 Michael Hrivnak 2017-02-23 18:52:20 UTC
https://pulp.plan.io/issues/2047#note-11

Publishing two yum repos at the same time where their publish paths share a parent directory could produce the issue. But not always. Probably not even very frequently.

Comment 21 Pavel Moravec 2017-02-24 09:04:18 UTC
I can't reproduce it either. 

When I added debugs to that code, I noticed it is executed only during syncing repos (from CDN):

Feb 24 09:43:38 pmoravec-sat62-rhel7 pulp: pulp.plugins.util.publish_step:WARNING: PavelM: publish_dir_parent=/var/lib/pulp/published/yum/https/repos/RedHat/Library/content/dist/rhel/server/7/7.2/x86_64/mrg-m/3, created it

But publishing a Content View with that repo, no such log / the method is not executed.


There must have been a change between 6.1 and 6.2 - maybe in directory structure of /var/lib/pulp or in using /var/cache/pulp/ ?

Or does Content View publish repos in a different way than before? (I dont think so, both repo sync and C.V. publish call  pulp.server.managers.repo.publish.publish pulp task).


Justin, Michael, any idea why Sat6.2 (before the fix) doesnt reproduce this BZ?

(imho this information itself is sufficient for marking it verified)

Comment 22 Michael Hrivnak 2017-02-27 19:37:26 UTC
I don't think anything changed about the structure from 6.1. The structure is very important to preserve because of how entitlement enforcement works.

Sorry, I have no idea why this is hard to reproduce on 6.2 specifically.

Comment 23 Lukas Pramuk 2017-03-03 12:48:30 UTC
VERIFIED.

@satellite-6.2.8-4.0.el7sat.noarch
pulp-server-2.8.7.6-1.el7sat.noarch

by this manual procedure:

1. create & sync 35 repos
2. create 100 CVs comprising all these 35 repos
3. publish all 100 CVs one after another

>>> no errors were encountered when repeatedly publishing CVs with many repos

Comment 25 errata-xmlrpc 2017-03-06 08:27:07 UTC
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://access.redhat.com/errata/RHBA-2017:0447


Note You need to log in before you can comment on or make changes to this bug.