Skip to content

Fix stuck leases when worker restarts with pending checkpoint leases#1718

Open
chenylee-aws wants to merge 1 commit intoawslabs:masterfrom
chenylee-aws:leaseshutdown
Open

Fix stuck leases when worker restarts with pending checkpoint leases#1718
chenylee-aws wants to merge 1 commit intoawslabs:masterfrom
chenylee-aws:leaseshutdown

Conversation

@chenylee-aws
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant