-
Notifications
You must be signed in to change notification settings - Fork 174
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
Deletes failing and cache not expiring on one particular model/association #211
Comments
I am seeing this as well, I cannot speak to the specific model issue as right now I'm just getting started using this and only have this on one model. Here are the related logs:
memcached
|
A little more info... If I manually run (what I think is) the delete command, something like: This actually sets the key correctly, then if I touch the record (to bust the cache), then the logs look like:
So two things
|
Ok, figured out the issue with manually running the command, this is because the fetcher the code is using is the fallback fetcher. The command it is actually trying to run is a It seems like both the MemCacheStore and the DalliStore do not respond to 'cas', so it seems like the fallback fetcher is correct? |
It looks like the cache backends are inconsistent with what is returned by a delete ActiveSupport::Cache::MemCacheStore#delete returns:
ActiveSupport::Cache::MemoryStore#delete returns:
ActiveSupport::Cache::MemcachedStore#delete seems to always return Memcached::Rails#delete returns:
so I'm not sure what the best way is to log actual request errors. The key not being found is not an actual error, it just means it tried to expire a record that wasn't cached or was already removed from the cache. |
Should we just move the delete failed log message to the CacheFetcher where it is more reliable so that it doesn't cause any confusion when using the FallbackFetcher? Or should we have the FallbackFetcher write the special |
This seems old enough to be stale, I'll close. If someone objects plz re-open. |
I'm not sure it's stale? I was waiting for someone who understood the problem well enough to fix it. We basically worked around it by just not using identity cache anywhere we hit this bug 😢 |
@bradonweiss it is just a logging issue as explained in #211 (comment), it was just that the cache backends aren't consistent with the value they return from their delete methods. I think we could just remove that log line to avoid that confusion. It isn't even doing anything for us at Shopify, since we are using ActiveSupport::Cache::MemcachedStore which just returns |
I don't think it was just a logging issue. There may be an issue with logging, but the cache was definitely not being busted. Or are you saying the logging issue was causing the cache busting to fail? |
It sounds like you are just getting that Also, I would suggest that you use ActiveSupport::Cache::MemcachedStore to avoid cache consistency issues, since CAS support is needed to avoid race conditions. |
I've got a weird issue with deletes failing when expiring. We use identity_cache in lots of places and it mostly works fine, except on this one particular model's association we're having problems. Here's an example from the console:
When I create a new record the deletes fail and the cache doesn't expire. I tailed memcached logs and see messages like
Writing an error: Not found
.Any idea what might be going wrong?
The text was updated successfully, but these errors were encountered: