Skip to content

Improve error handling for already deleted resources#4352

Merged
philippthun merged 4 commits intomainfrom
already-deleted-resources
May 13, 2025
Merged

Improve error handling for already deleted resources#4352
philippthun merged 4 commits intomainfrom
already-deleted-resources

Conversation

@johha
Copy link
Copy Markdown
Contributor

@johha johha commented May 9, 2025

If a user triggers two DELETE requests for the same resource within a few milliseconds two deletion jobs are created. If both jobs are be executed in parallel it might happen that one of them fails with a Sequel::NoExistingObject error. This change prevents this by catching those errors but only if the error message originates from the current model/ table. Therefore it is ensured that similar error messages when e.g. deleting sub resources still result in job failures.

The same applies if a user unbind routes but also deletes the route itself within a very short time period. For this case the route model now also catches Sequel::NoExistingObject errors related to route bindings.

Additionally, the error handling in the DeleteActionJob was improved to catch errors when the actions itself don't handle them.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

If a user triggers two DELETE requests for the same resource within a few milliseconds two deletion jobs are created.
If both jobs are be executed in parallel it might happen that one of them fails with a `Sequel::NoExistingObject` error.
This change prevents this by catching those errors but only if the error message originates from the current model/ table.
Therefore it is ensured that similar error messages when e.g. deleting sub resources still result in job failures.

The same applies if a user unbind routes but also deletes the route itself within a very short time period.
For this case the route model now also catches `Sequel::NoExistingObject` errors related to route bindings.

Additionally, the error handling in the DeleteActionJob was improved to catch errors when the actions itself don't handle them.
@johha johha marked this pull request as ready for review May 9, 2025 13:17
Otherwise it might return a dataset.
@johha johha force-pushed the already-deleted-resources branch from 41755b9 to b20fd02 Compare May 9, 2025 15:07
@philippthun philippthun merged commit c51369f into main May 13, 2025
12 checks passed
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request May 13, 2025
Changes in cloud_controller_ng:

- Improve error handling for already deleted resources
    PR: cloudfoundry/cloud_controller_ng#4352
    Author: Johannes Haass <johannes.haass@sap.com>
@moleske moleske deleted the already-deleted-resources branch May 21, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants