Project

General

Profile

Bug #10697

Content View Promote Fails with Katello::Errors::CandlepinError

Added by Partha Aji almost 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web UI
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1220556
This is the scenario that I saw the error, may be more ways to reproduce this:

1) Create a lifecycle env beyond Library
2) Create a content view
3) add a few yum repos to CV
4) Publish CV
5) Promote CV to next env
6) remove yum repos from CV
7) add different yum repos to CV
8) Publish new version of CV
9) Attempt to promote CV, receive task error:

"Exception: Katello::Errors::CandlepinError: The content with id 1431366478942 has already been promoted in this environment."

This comes from Candlepin:

https://github.com/candlepin/candlepin/blob/master/server/src/main/java/org/candlepin/resource/EnvironmentResource.java#L183

Associated revisions

Revision c2aa177c (diff)
Added by Partha Aji almost 8 years ago

Fixes #10697 - Improved CP SetContent add/delete logic

When setting/deleting the content id for an environment in candlepin a race
condition can happen. This because the SetContent action says:

1) Fetch me the list of existing content ids for this environment from
candlepin.
2) Take the existing content ids list in step 1 and subtract that from the
list of content ids provided in the input. In other words give me the list
of content ids to add.
3) Add the new content ids to environment in candlepin.

Problem is between step 1 and step 3 there can be a race condition
if 2 repos belonging to the same environment are clicked quickly, because
they run in parallel. It is possible that the content id has already
been added by one of the repo tasks causing a dupe error when the 2 nd
repo action tries to run.

When this problem occured candlepin used to throw 500. That part of the
code has now been fixed and instead a 409 is raised. This commit handles
the 409 instead of 500.

Also this commit handles the delete ids case. Again the problem here is
1) Fetch the list of existing content ids for this environment from
candlepin.
2) Take the list of content ids provided by the input, subtract that
from the existing content ids (obtained in step 1.) In other words get
the list of content ids to delete.
3) Remove the new content ids from the environment in candlepin.

Problem is between step 1 and step 3 there can be a race condition
if 2 repos belonging to the same environment are clicked quickly,
because they run in parallel. It is possible that the content id has
already been deleted by one of the repo actions there by causing a 404
when the second repo action runs.

Both these conditions should now be fixed with this commit.

Still have the retry logic because we do not want to go to an infinite
loop if Candlepin returns a 404 for not loading properly.

Revision 509efc87
Added by Partha Aji almost 8 years ago

Merge pull request #5271 from parthaa/set-content-fix

Fixes #10697 - Improved CP SetContent add/delete logic

History

#1 Updated by The Foreman Bot almost 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/5271 added
  • Pull request deleted ()

#2 Updated by Partha Aji almost 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Eric Helms almost 8 years ago

  • Legacy Backlogs Release (now unused) set to 31
  • Triaged changed from No to Yes

Also available in: Atom PDF