Skip to content

[Bug]: Database finalizer removal slow when deleting namespace due to exponential backoff #9554

Description

@mnencia

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

No response

Version

trunk (main)

What version of Kubernetes are you using?

1.34

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

YAML manifest

What happened?

The E2E test Declarative database management / will not prevent the deletion of the namespace with lagging finalizers fails intermittently with a timeout.

The reason is that when a cluster has DeletionTimestamp != nil, the controller still attempts regular reconciliation instead of immediately entering the deletion path. This reconciliation causes failures when trying to create resources in a terminating namespace, resulting in an exponential backoff that delays finalizer removal beyond the test timeout.

The problem self-corrects eventually, but is visible to the user as an excessively slow namespace deletion.

Ideal continuation fo the work done in #9430

Cluster resource

N/A

Relevant log output

See https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/20419155679

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. self-assigned this
    on Dec 22, 2025
  2. added
    bug 🐛Something isn't working
    E2E testsE2E tests tickets for easy triage on release process
    on Dec 22, 2025
  3. added theissue type on Dec 22, 2025
  4. dosubot commented on Dec 22, 2025

    @dosubot

    Your bug report matches a recently fixed issue: errors during finalizer removal were being logged but not returned, causing orphaned database finalizers and slow namespace deletion. This was tracked in issue #9430 and fixed by PR #9431, which ensures errors are properly returned so reconciliation is retried and finalizers are removed as expected.

    The relevant code for finalizer handling is in internal/management/controller/finalizers.go, and the Database controller now immediately exits reconciliation if DeletionTimestamp is set, otherwise it continues normal logic and requeues after a fixed interval (source). The exponential backoff you observed is from controller-runtime's default retry behavior when reconciliation fails, not explicit logic in the finalizer code.

    If you're running the latest main branch after PR #9431, this specific bug should be resolved. If you still see delays, it may be due to other errors during deletion in a terminating namespace. Let me know if you need help troubleshooting further or want to dig into edge cases.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about cloudnative-pg Share Dosu with your team

  5. added a commit that references this issue on Dec 23, 2025
    f4ad212
  6. added 3 commits that reference this issue on Dec 23, 2025
    4f10550
    5fde2e4
    9142185
  7. added a commit that references this issue on Dec 23, 2025
    36b2304
  8. added a commit that references this issue on Jan 20, 2026
    619f90c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

E2E testsE2E tests tickets for easy triage on release processbug 🐛Something isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions