Skip to content

Stuck service operations recovery - #5367

Draft
kathap wants to merge 4 commits into
mainfrom
stuck-service-operations-recovery
Draft

Stuck service operations recovery#5367
kathap wants to merge 4 commits into
mainfrom
stuck-service-operations-recovery

Conversation

@kathap

@kathap kathap commented Aug 14, 2026

Copy link
Copy Markdown
Contributor
  • A short explanation of the proposed change:

When CCDB is briefly unavailable during a broker polling cycle, the CC polling job can fail permanently (max_attempts=1) while the broker is still processing. This leaves service operations stuck: last_operation.state stays 'in progress' with no delayed job working on it, requiring operator intervention (more frequent on CCEE landscapes where CCDB restarts more often than on public IaaS).

This PR adds three periodic clock jobs that bring stuck operations to a definitive state automatically. Each uses FOR UPDATE SKIP LOCKED to prevent double processing across concurrent CC instances.

  • ServiceOperationsUpdateStuckInProgressFailed — detects stuck 'update' operations whose polling job has permanently failed and marks the operation and its pollable job as 'failed'. No orphan mitigation is triggered: an update targets a resource that already exists, so it must not be deprovisioned.
  • ServiceOperationsDeleteStuckInProgressRetry — detects stuck service-instance 'delete' operations and internally retries by re-enqueuing the original DeleteServiceInstanceJob (reset pollable to POLLING). Delete should ultimately succeed, so retry is the correct recovery. The original @start_time is preserved, so ReoccurringJob's max-duration expiry still bounds retries and a permanently-broken broker still ends in a terminal failed state.
  • ServiceOperationsBindingDeleteStuckInProgressRetry — same retry mechanism for credential bindings and service keys (re-enqueues the original DeleteBindingJob). Route bindings are skipped, matching the create-cleanup precedent.

All three are wired into the clock scheduler with a configurable frequency_in_seconds (default 1h), with matching properties in capi-release.

  • An explanation of the use cases your change solves
    A service instance/binding create, update, or delete gets stuck 'in progress' after a transient CCDB outage kills the polling job. Previously this required manual operator intervention (which the CFP requirement forbids). With this change:
    update: the client sees a definitive failed state instead of a hang, and the existing resource is left untouched (no unwanted deprovision).
    instance/binding delete: the delete is automatically resumed and completes, or reaches a terminal failed state once the max polling window elapses.

  • Links to any other associated PRs
    Stuck service operations recovery capi-release#681

  • 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

kathap added 3 commits August 12, 2026 12:39
When CCDB is briefly unavailable during a broker polling cycle, the CC
polling job can fail permanently (max_attempts=1) while the broker is
still processing. This leaves an update stuck: last_operation.state
stays 'in progress' with no delayed job working on it, requiring
operator intervention.

Add ServiceOperationsUpdateInProgressCleanup, a periodic job that
detects stuck 'update' operations whose polling job has permanently
failed and marks the operation and its pollable job as 'failed', giving
clients a definitive final state. A FOR UPDATE SKIP LOCKED guard
prevents double processing across concurrent CC instances.

Unlike the create cleanup, no orphan mitigation is triggered: an update
targets a resource that already exists, so it must not be deprovisioned.
Add ServiceOperationsDeleteStuckInProgressRetry, a periodic clock job that
detects service-instance delete operations stuck in 'in progress' (broker
still working, CC polling job permanently failed after a transient DB error)
and re-enqueues the original delete polling job instead of marking it failed.

The failed delayed_job's serialized handler is reused, preserving the original
user_audit_info and start_time so the ReoccurringJob max-duration expiry still
marks the operation failed once the original polling window elapses. No orphan
mitigation, since delete targets a resource that should be removed.
@kathap
kathap marked this pull request as draft August 14, 2026 09:39
Detect credential-binding and service-key delete operations stuck in
'in progress' with a permanently-failed polling job, and internally
retry by re-enqueuing the original DeleteBindingJob. Mirrors the
existing service-instance delete-retry job. Route bindings are skipped.
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.

1 participant