awslabs / amazon-dynamodb-lock-client

The AmazonDynamoDBLockClient is a general purpose distributed locking library built on top of DynamoDB. It supports both coarse-grained and fine-grained locking.
Other
472 stars 85 forks source link

Fix: Lock can be acquired after lease duration if the current owner has been terminated unexpectedly when using skipBlockingWait=true #79

Closed chris-ryan-square closed 1 year ago

chris-ryan-square commented 2 years ago

Issue #, if available: 44

Description of changes:

This solves the problem with the issue raised, allowing skipBlockingWait flag to be used safely. It tracks the "lookupTime" for the lock to handle if another client that has the lock has been terminated unexpectedly - and therefore can't update the lock itself.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

aquinney0 commented 1 year ago

I could be wrong, but the addition of the LOOKUP_TIME attribute means that this would be a great solution for:

https://github.com/awslabs/amazon-dynamodb-lock-client/issues/34

I wonder if it would be even better to store an 'expiration time' instead, as that could be functionally the same but also allow for easy integration with the TTL feature:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html

qvissak commented 1 year ago

I agree that we should abandon this proposed change for #88 after it is revised.

chris-ryan-square commented 1 year ago

No longer required