-
Notifications
You must be signed in to change notification settings - Fork 375
Description
In #3600 we introduced a cache to speedup the matching in Jwt predicates.
In the implementation we clear all the values in the cache but we hold a reference to the predicates created and never clean these up creating a memory leak. In high frequent route changing environments this could potentially being visible in memory graphs.
ref discussion https://github.com/zalando/skipper/pull/3600/files#r2313466897
In order to fix this I propose to use eskip.Predicate as another part of the cache key, such that the same 2 tuple of predicate and header string would lookup the same cached result.
Interestingly we could also use a single cache for all routes, but I am not sure if this creates a little lock contention, and normally I would rather have more memory in use than possible more lock wait in hot path like this.