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

fix: double-lock when multiple dashboards have the same UID #864

Merged
merged 2 commits into from
Jan 3, 2023

Conversation

weisdd
Copy link
Collaborator

@weisdd weisdd commented Dec 26, 2022

Description

As it was described in #860, controller tries to acquire a second lock (and, thus, gets stuck) when there are multiple dashboards with the same UID and one of those gets deleted.

The issue is that Lock() is called from within the for loop, so the fix simply requires the lock to be moved outside of the loop.

Additional changes:

  • Not sure why dashboard references with a particular uid would get removed for all namespaces, not just the one matching the delete request:
    => I fixed that, though, please, let me know if the behaviour was intentional;

  • RemovePluginsFor() didn't have lock:
    => Added the lock.

Relevant issues/tickets

Closes: #860

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • This change requires a documentation update
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a test case that will be used to verify my changes
  • Verified independently on a cluster by reviewer

Verification steps

Follow the steps described in #860:

  1. Deploy two dashboards with the same uid;
  2. Remove of of those;
  3. Reconciliation should not get stuck.

Copy link
Collaborator

@NissesSenap NissesSenap left a comment

Choose a reason for hiding this comment

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

This LGTM but I would like to get some feedback from @HubertStefanski or @pb82 since they got more history then I do.

@pb82 pb82 merged commit d4940b5 into grafana:master Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix this PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] GrafanaDashboardReconciler hangs when deleting GrafanaDashboard resource
3 participants