openam-jp / openam

Other
32 stars 15 forks source link

Memory leak: LDAPFilterCondition creates new ShutdownManager listener on each request #211

Closed ogis-miyamura closed 4 years ago

ogis-miyamura commented 4 years ago

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.

Steps to reproduce

  1. Install OpenAM + agent + agent profile + policy
  2. Add a LDAP Filter condition environment to the policy
  3. Disable subject TTL in order to see an impact more quickly: in Services > Policy Configuration > Subjects result Time To Live > set to 0
  4. Access the protected resource (redirect to AM ; log user in; agent doing policy evaluation) -> policy evaluation being the key here.
  5. Load test and take a heap dump

Expected Results

Should see only a small footprint for the shutdownmanager

Actual Results

ShutdownManager retained set increases regularly.

References