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

Requeued events are handled even after deletion of entity #365

Closed
anekdoti opened this issue Jan 19, 2022 · 3 comments · Fixed by #394
Closed

Requeued events are handled even after deletion of entity #365

anekdoti opened this issue Jan 19, 2022 · 3 comments · Fixed by #394
Labels
bug Something isn't working released

Comments

@anekdoti
Copy link

Describe the bug
If a reconciliation event is requeued with an exponential back-off, it is possible that it is handled even after its entity got deleted in the meantime.

Expected behavior
Reconciliation should not be triggered after an entity got deleted. Or should the existence / deletion timestamp of the entity be checked in the reconciliation handler? If yes, it would be good to document this.

@anekdoti anekdoti added the bug Something isn't working label Jan 19, 2022
@anekdoti
Copy link
Author

From my understanding of https://github.com/buehler/dotnet-operator-sdk/blob/master/src/KubeOps/Operator/Controller/ManagedResourceController%7BTEntity%7D.cs, requeued events for entities that do not exist anymore should be filtered out. So I just added a check for the DeletionTimestamp in the reconciliation handler. However, this does not seem to suffice.

@erin-allison
Copy link
Contributor

The problem here is caused by the fact that while a manually re-queued event will update the resource's data when it processes...

private IObservable<Unit> RequeuedEvents => _requeuedEvents
.Do(_ => _metrics.RequeuedEvents.Inc())
.Select(
data => Observable.Return(data).Delay(data.Delay))
.Switch()
.Select(
data =>
Observable.FromAsync(
async () =>
{
var queuedEvent = await UpdateResourceData(data.Resource);
return data.ResourceEvent.HasValue && queuedEvent != null
? queuedEvent with { ResourceEvent = data.ResourceEvent.Value }
: queuedEvent;
}))

... an event which is retried because it threw an exception does not have the same logic.

@github-actions
Copy link

🎉 This issue has been resolved in version 6.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants