Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed rare bulk_update() deadlock in ContentSaver. #2478

Merged
merged 1 commit into from Apr 6, 2022

Conversation

ggainey
Copy link
Contributor

@ggainey ggainey commented Apr 4, 2022

See https://bugzilla.redhat.com/show_bug.cgi?id=2062526 for details on
forcing the deadlock and discussion of the fix.

fixes #2430.
[nocoverage]

@dralley
Copy link
Contributor

dralley commented Apr 4, 2022

Does this need a 3.14 backport? (Presumably a manual one)

@ggainey
Copy link
Contributor Author

ggainey commented Apr 4, 2022

Does this need a 3.14 backport? (Presumably a manual one)

Target is set to 6.11 (which is 3.16) - but 6.10.z flag is also set, so we prob should bring it back to 3.14 as well.

ContentArtifact.objects.bulk_update(to_update_ca_bulk, ["artifact"])
# To avoid a similar deadlock issue when calling get_or_create, we sort the
# "new" CAs to make sure inserts happen in a defined order. Since we can't
# trust the pulp_id (by the time we go to create a CA< it may already exist,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/</,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/</,

Ugh, prob my most-common typo :(

See https://bugzilla.redhat.com/show_bug.cgi?id=2062526 for details on
forcing the deadlock and discussion of the fix.

fixes pulp#2430.
[nocoverage]
@ggainey ggainey merged commit 0238741 into pulp:main Apr 6, 2022
9 checks passed
@patchback
Copy link

patchback bot commented Apr 6, 2022

Backport to 3.14: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 0238741 on top of patchback/backports/3.14/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478

Backporting merged PR #2478 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pulp/pulpcore.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.14/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478 upstream/3.14
  4. Now, cherry-pick PR Fixed rare bulk_update() deadlock in ContentSaver. #2478 contents into that branch:
    $ git cherry-pick -x 0238741f707c4f2c7d702e2ac221c1f73df6cd60
    If it'll yell at you with something like fatal: Commit 0238741f707c4f2c7d702e2ac221c1f73df6cd60 is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x 0238741f707c4f2c7d702e2ac221c1f73df6cd60
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fixed rare bulk_update() deadlock in ContentSaver. #2478 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.14/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Apr 6, 2022

Backport to 3.17: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.17/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478

Backported as #2489

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Apr 6, 2022

Backport to 3.15: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 0238741 on top of patchback/backports/3.15/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478

Backporting merged PR #2478 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pulp/pulpcore.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.15/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478 upstream/3.15
  4. Now, cherry-pick PR Fixed rare bulk_update() deadlock in ContentSaver. #2478 contents into that branch:
    $ git cherry-pick -x 0238741f707c4f2c7d702e2ac221c1f73df6cd60
    If it'll yell at you with something like fatal: Commit 0238741f707c4f2c7d702e2ac221c1f73df6cd60 is a merge but no -m option was given., add -m 1 as follows intead:
    $ git cherry-pick -m1 -x 0238741f707c4f2c7d702e2ac221c1f73df6cd60
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fixed rare bulk_update() deadlock in ContentSaver. #2478 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.15/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Apr 6, 2022

Backport to 3.16: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.16/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478

Backported as #2490

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link

patchback bot commented Apr 6, 2022

Backport to 3.18: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.18/0238741f707c4f2c7d702e2ac221c1f73df6cd60/pr-2478

Backported as #2491

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bulk_update() in content-stages can cause (very rare) deadlock
3 participants