rhashimoto / wa-sqlite Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible Web Locks deadlock #49
Comments
|
This is a trickier issue than I initially thought. When SQLite returns Ideally we want to return SQLite's policy is to have the application keep track of its transactions instead of caching them and doing retry automatically so it makes sense for wa-sqlite to do the same thing. We don't know what other code the application might be running alongside the transaction statements that also would need to be replayed so making the application responsible for rewinding everything seems best for now (maybe in the future there could be an API "transaction" call that takes an idempotent function argument). That does make application development when there is potential concurrency a little bit harder, which is unfortunate. So what I'm going to do is change the default WebLocks.js to use only exclusive locking, which removes that deadlock possibility. This will remove the need for applications to handle An implementation note: We can do better than a timeout for WebLocksShared. We just need to distinguish when we can't get a RESERVED lock because someone else already has it versus because someone is just getting a SHARED lock. We can do that by adding another lock and polling it with LockManager.query() - it will really be used as a signal instead of as a lock (it won't block anything). |
|
Completed as described. |
There is a potential deadlock in src/examples/WebLocks.js as described here.
xLock()is supposed to timeout to prevent this but the current implementation does not.The text was updated successfully, but these errors were encountered: