Closed
Description
cloud-ndb v1.8.0 with Memcache global cache
There is a sequence of steps that can lead to cache inconsistency which is caused by the read thread failing to write a lock for transient reasons. The sequence of steps is:
- Reader gets from memcache and finds nothing
- Writer writes lock value
- Reader has transient failure when attempting to lock the key
- Reader watches key
- Reader reads from db
- Writer updates db
- Writer fails to delete lock from db for whatever reason (connection reset most likely currently)
- Reader writes stale value using cas
The problem here is that exceptions on transient failures on cache operations from reads are swallowed, which for most of the calls is fine, however very specifically for the lock call in _datastore_api.lookup()
any exception needs to be treated as the key being locked such that it will not attempt to update memcache with a new value