fix(extension-redis): redlock release race condition#958
fix(extension-redis): redlock release race condition#958janthurau merged 6 commits intoueberdosis:mainfrom
Conversation
Signed-off-by: Matt Krick <matt.krick@gmail.com>
|
@mattkrick Thanks a lot for your PR! Unfortunately the tests are failing here with what seems to be a known problem: sesamecare/redlock#6. Wondering how this is working on your end 🤔 ? |
|
interesting! In prod I use uWS, so perhaps it's specific to the websocket implementation. I'll dig deeper note to self: can reproduce if the extension before redis (Database) throws inside onStoreDocument. Need to dig into how exceptions are handled in chained extensions and bail gracefully |
Signed-off-by: Matt Krick <matt.krick@gmail.com>
…pocus into fix/redlock-release-race
Signed-off-by: Matt Krick <matt.krick@gmail.com>
|
testing locally, I was able to reproduce the error by making a change on the client & then inside onStoreDocument I opened a direct connection & made another change. |
Fixes a race condition with the redis extension where if 2 actors try to edit the same document in quick succession it starts to fail.
I also updated to the latest version of redlock. Since redlock is no longer maintained, everyone started using this fork that is written in typescript and uses ioredis v5.
The bug was so wild I wrote a blog post on it, hopefully it describes the problem better: https://www.mattkrick.dev/blog/troubleshooting-redlock-guarantees-and-pitfalls.