Comments (3)
Looks like this problem occurs because when the existing lock is retrieved, the timestamp that is used to evaluate expiry in isExpired()
is updated. So the test waits leaseDuration * 3L
, which would correctly cause isExpired()
to return true
because the timestamp is T - (T - leaseDuration * 3) > leaseDuration
, but when the second acquireLock
is called, that timestamp is updated to T
(and T - T
is not greater than leaseDuration
) [ref]. This causes isExpired()
to return false. In the normal case, this won't be an issue because the lock will eventually be released. However, in the corner case where a lock expires due to, say, dying process, then it appears that the lock will never be able to be retrieved again so long as shouldSkipBlockingWait is set to true.
Long story short, seems like a major bug in the library. There appears to be no clear workaround from client-side either.
from amazon-dynamodb-lock-client.
I've encountered this issue as well. It seems like the "shouldSkipBlockingWait" support is in conflict with how lease expiration works (requires a process to wait for the lock for the lease duration before the lock is considered expired).
It seems we simply can't use "shouldSkipBlockingWait" until this is resolved, unfortunately.
from amazon-dynamodb-lock-client.
@schen42 I would not agree in calling this a corner case, rather a case which I assumed was supported.
However, in the corner case where a lock expires due to, say, dying process, then it appears that the lock will never be able to be retrieved again so long as shouldSkipBlockingWait is set to true.
I've encountered this issue as well version, 1.2.0.
from amazon-dynamodb-lock-client.
Related Issues (20)
- Separate blocking and non-blocking methods instead of using skipBlockingWait
- Will the latest release be pushed to Maven? HOT 1
- can client.acquireLock callback be made asynchronous?
- Getting this exception while app initialisation. Is this some known issue? HOT 1
- Upgrade to JDK17+ HOT 1
- Any port on the horizon to Python/Javascript?
- Documentation on inter-region locking
- Service: AmazonDynamoDBv2; Status Code: 400; Error Code: AccessDeniedException
- Is it possible to migrate this set of logic to a relational database, such as MySQL
- Interest in a TypeScript port? HOT 1
- Change License to ASLv2 or MIT
- amazon-dynamodb-lock-client as singleton
- Table cloudformation template
- [Feature Request] Soft Unlock
- withShouldSkipBlockingWait will always fail to acquire lock if already exists and expired HOT 7
- Potential Bug - Client should reset leaseDuration waiting time when recordVersionNumber noticed to change
- Failed to run demo code HOT 1
- Upgrade aws skd version
- Avoid `synchronized` during blocking operations (loom friendliness)
- Is this project dead?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-dynamodb-lock-client.