controller: lock before reading finalizer state in handleDeletion#79
Open
tamalsaha wants to merge 1 commit into
Open
controller: lock before reading finalizer state in handleDeletion#79tamalsaha wants to merge 1 commit into
tamalsaha wants to merge 1 commit into
Conversation
handleDeletion checked ContainsFinalizer first and only then acquired the serialization mutex. If MaxConcurrentReconciles ever goes above 1, two goroutines could both see "finalizer present", then race on the cleanup (one runs while the other has already removed it). Acquire the lock up front so the finalizer check and the cleanup-then-remove sequence run as one critical section. Cheap correctness step that lets later PRs bump concurrency without revisiting this path. Signed-off-by: Tamal Saha <tamal@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`handleDeletion` used to check `ContainsFinalizer` first and only then acquire the serialization mutex. If `MaxConcurrentReconciles` is ever bumped above 1, two goroutines could both see "finalizer present" and race on the cleanup.
Acquire the lock up front so the finalizer check and the cleanup-then-remove sequence run as one critical section. Cheap correctness step that lets later PRs bump concurrency without revisiting this path.
Test plan