Skip to content

OCPBUGS-75913: Fix VolumeSnapshot race condition in backup processing#182

Open
jparrill wants to merge 1 commit intoopenshift:mainfrom
jparrill:fix-OCPBUGS-75913
Open

OCPBUGS-75913: Fix VolumeSnapshot race condition in backup processing#182
jparrill wants to merge 1 commit intoopenshift:mainfrom
jparrill:fix-OCPBUGS-75913

Conversation

@jparrill
Copy link
Contributor

@jparrill jparrill commented Feb 5, 2026

What this PR does / why we need it

This PR fixes a race condition in the CheckVolumeSnapshot() function where VolumeSnapshots deleted between the List and Get calls would cause the entire backup to fail. The fix adds graceful handling of NotFound errors, allowing the plugin to skip deleted snapshots and continue processing remaining ones.

Problem: When iterating over VolumeSnapshots from a List call, if a snapshot is deleted between the List (line 286) and subsequent Get call (line 292), the 404 NotFound error was treated as fatal, aborting processing of subsequent snapshots and marking backups as PartiallyFailed.

Solution: Add apierrors.IsNotFound(err) handling in CheckVolumeSnapshot() to match the existing pattern in CheckVolumeSnapshotContent(), allowing deleted snapshots to be skipped gracefully.

Impact: Reduces backup failure rate from 25/100 (observed with ARO-HCP PremiumV2 disks) to near 0% by eliminating this specific race condition.

Which issue(s) this PR fixes

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira:solve OCPBUGS-75913 origin

…fully

Fix race condition in CheckVolumeSnapshot() where snapshots deleted between
List and Get calls would cause backup failures. Now gracefully skips deleted
snapshots and continues processing remaining ones, matching the pattern used
in CheckVolumeSnapshotContent().

This resolves intermittent PartiallyFailed backups (25/100 failure rate)
when snapshot cleanup races with plugin processing.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 5, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 5, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 5, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Feb 5, 2026
@openshift-ci-robot
Copy link

@jparrill: This pull request references Jira Issue OCPBUGS-75913, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it

This PR fixes a race condition in the CheckVolumeSnapshot() function where VolumeSnapshots deleted between the List and Get calls would cause the entire backup to fail. The fix adds graceful handling of NotFound errors, allowing the plugin to skip deleted snapshots and continue processing remaining ones.

Problem: When iterating over VolumeSnapshots from a List call, if a snapshot is deleted between the List (line 286) and subsequent Get call (line 292), the 404 NotFound error was treated as fatal, aborting processing of subsequent snapshots and marking backups as PartiallyFailed.

Solution: Add apierrors.IsNotFound(err) handling in CheckVolumeSnapshot() to match the existing pattern in CheckVolumeSnapshotContent(), allowing deleted snapshots to be skipped gracefully.

Impact: Reduces backup failure rate from 25/100 (observed with ARO-HCP PremiumV2 disks) to near 0% by eliminating this specific race condition.

Which issue(s) this PR fixes

Fixes https://issues.redhat.com/browse/OCPBUGS-75913

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira:solve OCPBUGS-75913 origin

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

Updates Go toolchain from 1.24.4 to 1.25.3 and upgrades multiple Kubernetes-related dependencies. Modifies .gitignore to include AI work directory and adjusts cache ignore pattern. Alters error handling in CheckVolumeSnapshot to skip missing VolumeSnapshot objects instead of failing.

Changes

Cohort / File(s) Summary
Configuration & Dependencies
.gitignore, go.mod
.gitignore updated to replace cache ignore pattern and add AI work directory exclusion. go.mod bumps Go toolchain to 1.25.3 and upgrades dependencies including kubernetes, controller-runtime, prometheus, and various golang.org/x packages.
Source Code Logic
pkg/common/utils.go
Error handling in CheckVolumeSnapshot modified to continue to next item when VolumeSnapshot is not found, rather than returning an error.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link

openshift-ci bot commented Feb 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jparrill

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2026
@jparrill
Copy link
Contributor Author

jparrill commented Feb 5, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Feb 5, 2026
@openshift-ci-robot
Copy link

@jparrill: This pull request references Jira Issue OCPBUGS-75913, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (yli2@redhat.com), skipping review request.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jparrill
Copy link
Contributor Author

jparrill commented Feb 5, 2026

/auto-cc

@openshift-ci openshift-ci bot requested review from enxebre and muraee February 5, 2026 10:43
@enxebre
Copy link
Member

enxebre commented Feb 13, 2026

seems like you might want to add a test case and a log for this case.
I'm also curious about the success ratio, why do those volumes are deleted?
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 13, 2026
@michalskrivanek
Copy link

LGTM, I observed the problem with a similar probability on BM as well, cherry-picked this fix to latest oadp-1.5 and it fixes the problem indeed

@enxebre IIUC in my case at least the VolumeSnapshot is processed and deleted by the time plugin gets to it

@jparrill jparrill marked this pull request as ready for review February 16, 2026 08:23
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 16, 2026
@openshift-ci openshift-ci bot requested a review from bryan-cox February 16, 2026 08:25
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 16, 2026
@openshift-ci
Copy link

openshift-ci bot commented Feb 16, 2026

New changes are detected. LGTM label has been removed.

@jparrill
Copy link
Contributor Author

@openshift-ci
Copy link

openshift-ci bot commented Feb 16, 2026

@jparrill: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify a3d51c8 link true /test verify
ci/prow/unit a3d51c8 link true /test unit
ci/prow/build a3d51c8 link true /test build

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-ci-robot
Copy link

@jparrill: This pull request references Jira Issue OCPBUGS-75913, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (jiezhao@redhat.com), skipping review request.

Details

In response to this:

What this PR does / why we need it

This PR fixes a race condition in the CheckVolumeSnapshot() function where VolumeSnapshots deleted between the List and Get calls would cause the entire backup to fail. The fix adds graceful handling of NotFound errors, allowing the plugin to skip deleted snapshots and continue processing remaining ones.

Problem: When iterating over VolumeSnapshots from a List call, if a snapshot is deleted between the List (line 286) and subsequent Get call (line 292), the 404 NotFound error was treated as fatal, aborting processing of subsequent snapshots and marking backups as PartiallyFailed.

Solution: Add apierrors.IsNotFound(err) handling in CheckVolumeSnapshot() to match the existing pattern in CheckVolumeSnapshotContent(), allowing deleted snapshots to be skipped gracefully.

Impact: Reduces backup failure rate from 25/100 (observed with ARO-HCP PremiumV2 disks) to near 0% by eliminating this specific race condition.

Which issue(s) this PR fixes

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira:solve OCPBUGS-75913 origin

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants