-
Task
-
Resolution: Done
-
Major
-
5.1.0.CR3
OOM occure on peaks of putting objects in cache configured to use AsyncStore.
See Steps to Reproduce.
Profiling shows that the gc path is through AsyncStore.state field.
The AsyncStore.executor initialized to ThreadPoolExecutor with DiscardPolicy to silently discard tasks if the queue is full, which delays async processing of entries in state map, which continues to grow.
Suggested solution.
Instead of DiscardPolicy use customized behavior, which is to estimate accumulated state size and (probably comparing it with modificationQueueSize) decide to discard or to block until it is processed.
The downside of suggested solution is the necessity to lock to estimate state size every time the task is rejected. Possibly it can be alleviated by increasing workingQueue size, so that it survive peaks without rejection.