[OPENAM-12037] Memory leak: LDAPFilterCondition creates new ShutdownManager listener on each request Created: 02/Nov/17 Updated: 02/Jun/20 Resolved: 06/Nov/17
|Affects Version/s:||13.5.1, 14.0.0, 14.1.0, 14.1.1, 14.5.0|
|Fix Version/s:||13.5.2, 5.5.2|
|Reporter:||Nathalie Hoet||Assignee:||Mark de Reeper|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
|Sprint:||AM Sustaining Sprint 44|
|Support Ticket IDs:|
|Needs QA verification:||
|Are the reproduction steps defined?:||
Yes and I used the same an in the description
When using the condition environment LDAPFilter OpenAM adds a ShutdownManager Listener repeatedly. ShutdownManager listeners are not removed until OpenAM is shutdown, so it creates a leak.
With subject time to live disabled and many LDAPFilter condition filters, the leak will be noticeable more quickly. But even with subject ttl enabled, new listeners would be added after the cache expire, creating a slow leak as well.
See screenshot. Impact shown on screenshot is minimal (0,52%), but shows already 11k+ entries. In the customer's case, there were 1.5 million such entries occupying 77% of retained heap after one day of running.
The setPolicyConfig method in the LDAPFilterCondition adds a new ShutdownManagerListener each time it is called (if cache is disabled or expired), although only one ShutdownManager is needed.
As the initConnectionPool already adds the listener and does that only once, the section adding the ShutdownManager can be removed.