-
Notifications
You must be signed in to change notification settings - Fork 103
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
Unable to serve from cache if cache entry was expired or invalidated #788
Comments
Actually we must keep stale responses in the cache, but servicing stale responses is the subject of #522 . The problem described in this issues seems can be easily fixed with checking whether the found cache entry Remembering |
I've added a PR #1532 that implements more or less the idea described in your comment. I did some simple manual testing, and the automated "cache" tests also pass. Completely removing the liveness check from Actually I think that right now it isn't very useful to return stale entries, because they aren't used. But it will make more sense with 522. Also can you please clarify where the comment about record locking/RC should go? It seems we already take a bucket lock when iterating, and anyway we'd probably have to review all uses of TDB when implementing deletion. |
Yeah, I agree: let's not to return stale records from
Yeah, we don't need it. I just didn't touch the code for a while :) |
The issue is here: https://github.com/tempesta-tech/tempesta/blob/master/tempesta_fw/cache.c#L852
__cache_add_node()
must revalidate or remove already existing entry to thekey
given instead of unconditional addition of a new cache entry. The new cache entry will have the same key as the expired one, so the new entry will be added into one collision chain with expired entry. In most cases it will be added to the end of the chain.This make impossible to get not expired cache entry when serving new requests. And response to every request of that resource will be added into cache. That leads to memory leakage.
Steps to reproduce:
Note: there is a few more tasks on cache revalidation: #515 #518
Depends on #515 (TDBv2, removal is required).
The text was updated successfully, but these errors were encountered: