Enhancement
Critical
Major
Detail
Detail
Major
#26059
MemoryLeak because the SecurityStorage is a ClusterManagerListener that does not deregister
When the tl:PersistencyLayer is restarted, the old tl:KnowledgeBase is stuck in memory. References chain:
- tl:DBKnowledgeBase
- tl:DBKnowledgeObject
- tl:AttributedStructuredElementWrapper
- tl:ElementBoundHelper
- tl:StorageAccessManager
- tl:ElementSecurityStorage
- Is a tl:ClusterManagerListener.
- tl:ClusterManager
- ClusterManager.Module.INSTANCE
Solution
The tl:SecurityStorage is no longer directly a tl:ClusterManagerListener. Instead, it registers one that holds the tl:SecurityStorage by WeakReference only.
Justification: The tl:SecurityStorage is not a service, but only a tl:ConfiguredInstance on the tl:AccessManager. Therefore, there is no proper time for it to deregister as a listener.
Related tickets
Raised as part of #26037, along with #26058.
Test
Run the scripted tests in the demo. Just before running the final tests, create a dump]. Open it for example with [JavaResources#Profiler:JVisualVM|JVisualVM]. Open the histogram of the classes, filter for the class tl:DBKnowledgeBase and pay attention to the number of instances. There must be only one.