-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: liferay-faces-3.0.0-legacy-ga1, liferay-faces-3.0.1-legacy-ga2, liferay-faces-3.0.2-legacy-ga3, liferay-faces-3.0.3-legacy-ga4, liferay-faces-3.0.4-legacy-ga5, liferay-faces-3.0.0-ga1, liferay-faces-3.0.1-ga2, liferay-faces-3.0.2-ga3, liferay-faces-3.0.3-ga4, liferay-faces-3.0.4-ga5, liferay-faces-3.1.0-ga1, liferay-faces-3.1.1-ga2, liferay-faces-3.1.2-ga3, liferay-faces-3.1.3-ga4, liferay-faces-3.1.4-ga5, liferay-faces-3.2.4-ga5, liferay-faces-4.2.5-ga6
-
Component/s: Liferay Faces Bridge Impl / Demos / Tests
-
Labels:None
Hello, All
Below is reason of the memory leaks that we have faced after upgrading from Liferay 6.1.1 to Liferay 6.1.2.
Memory dump analysis revealed that ViewScope beans are not being destroyed properly in LR6.1.2, meanwhile in LR6.1.1 no leaks were found.
The root reason of the issue is that Liferay Faces in LR6.1.2 have wrong expectations how beans are stored in the JSF. The way of storing has changed in the version of JSF 2.1.28. Even in the master branch of the Liferay's bridge.
Here's the diff between 2.1.28 and 2.1.27 versions of the code where ViewScope beans are being stored in the sessionMap:
http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-impl/2.1.28/com/sun/faces/application/view/ViewScopeManager.java/
> if (sessionMap.get(ACTIVE_VIEW_MAPS) == null)
http://grepcode.com/file/repo1.maven.org/maven2/com.sun.faces/jsf-impl/2.1.27/com/sun/faces/application/view/ViewScopeManager.java/
> if (sessionMap.get(ACTIVE_VIEW_MAPS) == null)
But Liferay expects that beans have been put into the map like 2.1.27 version do and gets them in the following way(lines 210-213):
https://github.com/liferay/liferay-faces/blob/3.0.x/bridge-impl/src/main/java/com/liferay/faces/bridge/servlet/BridgeSessionListener.java
> // If the current session attribute is Mojarra-vendor-specific, then
> String fqcn = attributeValue.getClass().getName();
>
> if ((fqcn != null) && (fqcn.contains(MOJARRA_PACKAGE_PREFIX))) {
where
> private static final String MOJARRA_PACKAGE_PREFIX = "com.sun.faces";
But Collections.synchronizedMap is a "java.util" package so if-condition is false and beans' cleanup code is not being invoked.
After downgrade to the jsf-impl 2.1.27 leaks were gone. I believe that this is good but not a temporary solution.
Could you please confirm that Liferay faces are working as described above or please denote the wrong place in the description.