fix: memory leak in id_token mutator cache#1209
Conversation
1c7096d to
ed72272
Compare
aeneasr
left a comment
There was a problem hiding this comment.
Thank you! This makes sense - one remark though. If you see high memory use the cache is probably misconfigured. Ristretto does evict items when the cache size limit has been reached so theoretically you don’t need TTL (but it makes sense because otherwise the cache might evict tokens that are still valid)
Agreed 👍 |
Set a TTL on the cached JWTs in the
id_tokenmutator.It fixes a memory leak in Oathkeeper 🙌
We are running internally a fork of Oathkeeper with this patch applied, and the resulting memory footprint:

Unsure how to properly test it properly in a unit test though, since the
getFromCachelogic also checks if the cached TTL value is not expired (and not only the new ristretto internal TTL).Related issue(s)
Split from #1177.
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further Comments