Fix stuck leases when worker restarts with pending checkpoint leases#1718
Open
chenylee-aws wants to merge 1 commit intoawslabs:masterfrom
Open
Fix stuck leases when worker restarts with pending checkpoint leases#1718chenylee-aws wants to merge 1 commit intoawslabs:masterfrom
chenylee-aws wants to merge 1 commit intoawslabs:masterfrom
Conversation
fbb7ab0 to
3c8b7b0
Compare
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.
Description of changes:
During graceful lease handoff from Worker A to Worker B, a lease can become stuck in a pending checkpoint state when Worker A fails to complete the checkpoint (e.g., due to spurious retries). This leaves the lease with checkpointOwner set to Worker A and leaseOwner set to Worker B.(A valid state)
If Worker B is running, it will not try to acquire the lease because it sees the lease is in pending checkpoint state and leaseDiscover would prevent it to acquire the lease. However, if Worker B restarts and initializes its
LeaseCoordinator, it discovers this lease during the initialize() call. The worker incorrectly acquires and immediately attempts to shut down the lease. The shutdown logic fails to release the lease because the worker never explicitly drops it, causing the heartbeat to continue indefinitely and leaving the lease stuck.
The change adds logic in the initialize method to also not acquire pendingCheckpoint leases as done in leaseDiscoverer. It also adds logic to not renew leases that's not in an expected state
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.