await memcache.set resolving before write complete
Closed this issue · 4 comments
Hello,
We have been chasing down a very low percentage issue (about 100 out of every 1M writes) where the promise resolves from a set before the contents of the cache have changed. We have validated this by:
result = await memcached.set(cacheKey, m1); let delay = await wait(5); let r1 = await memcached.get(cacheKey);
and comparing m1/r1. In this case, the contents are a deeply nested JSON object (about 4-5 levels deep) of around 30kB. The content is effectively the same for all writes, apart from a few simple value changes. We are using 0.2.21 on node 10.12.0. memcached is 1.4.25 Ubuntu. Any suggestions or help gladly appreciated.
specifically this is happening on 1.4.25-2ubuntu1.5
Hmm very odd, would love any additional info you can provide to help troubleshoot!
I'm trying to set up a test case to reproduce it but haven't been able to yet
Victor I expect I'm going to need to apologise here. It seems that there are asynchronous processes that under some circumstance cause instantaneous writes to the same cache entry (within a mS of each other even) and so our write/read/compare for the second write is seeing the read data from the first write (that gets written to memcached). There is a vast amount of data flowing through our codebase and the cache updates are driven from a mongodb changeStream (which is supposed to sequence the data), but obviously things are happening so quickly that two updates to the same mongo record are showing up as change events almost instantaneously. We are pretty confident at this stage that it is not this module (or memcached) that is the root cause. Happy for this to be closed and will re-open again if indeed it shows up as being involved.
All good, thanks for helping to investigate, I'm glad to hear it's not a Memcache Plus problem. Will close now, if an issue does arise feel free to open a new issue. Good luck sorting this out!