-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrating timeouts #3
Conversation
There's a problem here with the There's a timing issue with the This doesn't appear to affect the But I can see that it should really be unlocked at that point, but it isn't. So it's a timing issue. We could do something to "delay" the release somewhat, or delay at the end of the releasing function after calling |
Seems like it should be possible to reproduce with just any lock, and then 2 timed out attempts to get the lock, and checking |
The lack of timeout support in |
I've reproduced the timing bug and posted upstream: DirtyHairy/async-mutex#54 A quickfix for now is to do |
After reviewing https://javascript.info/event-loop, I think we should use A new utility function can be created for this called
Compared to |
Note that without cancellable promises, some of the timeout usages does leave dangling noop promises around. This is not going to be solved until ES7 or JS comes up with a proper way to cancel promises. I did find some interesting packages for this though: MatrixAI/Polykey#297 (comment) It shouldn't be a huge issue. The noop promises will just be GCed. |
An unexpected discovery. By using |
With the |
Description
This brings in the
timeout
parameter to locking. This enables us to wait for a certain amount of time before giving up, and in such a case, can help resolve deadlocks after a random jitter.Issues Fixed
Tasks
Lock
RWLockWriter
RWLockReader
Final checklist