You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2023/02/15 15:46:00 UTC

[jira] [Commented] (MYFACES-4563) ViewScope Memory Leak When Trace Enabled

    [ https://issues.apache.org/jira/browse/MYFACES-4563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689201#comment-17689201 ] 

Volodymyr Siedlecki commented on MYFACES-4563:
----------------------------------------------

The code tries to retrieve the viewMap from the viewRoot, but, since the attirubte isn't there,  it's created.  UIViewRoot.getViewMap call. It calls "this.getViewMap(true);" create is true. 
 
[https://github.com/apache/myfaces/blob/4a996076a298b3767dab5e16fd312d5221e6b14a/api/src/main/java/jakarta/faces/component/UIViewRoot.java#L882]




{color:#4ec9b0}UIViewRoot{color}{color:#d4d4d4}.getViewMap() ({color}{color:#d16969}/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/{color}{color:#d4d4d4}jakarta.faces.component/{color}{color:#4ec9b0}UIViewRoot{color}{color:#d4d4d4}.class:{color}{color:#b5cea8}882{color}{color:#d4d4d4}){color}
{color:#4ec9b0}GeneratedMethodAccessor1449{color}{color:#d4d4d4}.invoke({color}{color:#4ec9b0}Object{color}{color:#d4d4d4},{color}{color:#4ec9b0}Object{color}{color:#d4d4d4}[]) ({color}{color:#4ec9b0}Unknown{color}{color:#d4d4d4} {color}{color:#4ec9b0}Source{color}{color:#d4d4d4}:{color}{color:#b5cea8}-1{color}{color:#d4d4d4}){color}
{color:#4ec9b0}Method{color}{color:#d4d4d4}.invoke({color}{color:#4ec9b0}Object{color}{color:#d4d4d4},{color}{color:#4ec9b0}Object{color}{color:#d4d4d4}[]) ({color}{color:#d16969}/java.base/{color}{color:#d4d4d4}java.lang.reflect/{color}{color:#4ec9b0}Method{color}{color:#d4d4d4}.class:{color}{color:#b5cea8}566{color}{color:#d4d4d4}){color}
{color:#d4d4d4}_ComponentAttributesMap.getComponentProperty({color}{color:#4ec9b0}PropertyDescriptorWrapper{color}{color:#d4d4d4}) ({color}{color:#d16969}/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/{color}{color:#d4d4d4}jakarta.faces.component/_ComponentAttributesMap.class:{color}{color:#b5cea8}658{color}{color:#d4d4d4}){color}
{color:#d4d4d4}_ComponentAttributesMap.get({color}{color:#4ec9b0}Object{color}{color:#d4d4d4}) ({color}{color:#d16969}/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/{color}{color:#d4d4d4}jakarta.faces.component/_ComponentAttributesMap.class:{color}{color:#b5cea8}317{color}{color:#d4d4d4}){color}
{color:#d4d4d4}_ViewAttributeMap.get({color}{color:#4ec9b0}Object{color}{color:#d4d4d4}) ({color}{color:#d16969}/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/{color}{color:#d4d4d4}jakarta.faces.component/_ViewAttributeMap.class:{color}{color:#b5cea8}98{color}{color:#d4d4d4}){color}
{color:#4ec9b0}DebugUtils{color}{color:#d4d4d4}.printComponent({color}{color:#4ec9b0}UIComponent{color}{color:#d4d4d4},{color}{color:#4ec9b0}PrintStream{color}{color:#d4d4d4},{color}{color:#4ec9b0}int{color}{color:#d4d4d4},{color}{color:#4ec9b0}boolean{color}{color:#d4d4d4},{color}{color:#4ec9b0}String{color}{color:#d4d4d4}) ({color}{color:#d16969}/org/{color}{color:#d4d4d4}apache{color}{color:#d16969}/myfaces/{color}{color:#d4d4d4}util/{color}{color:#4ec9b0}DebugUtils{color}{color:#d4d4d4}.java:{color}{color:#b5cea8}225{color}{color:#d4d4d4}){color}

> ViewScope Memory Leak When Trace Enabled
> ----------------------------------------
>
>                 Key: MYFACES-4563
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4563
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 4.0.0-RC4
>            Reporter: Volodymyr Siedlecki
>            Priority: Major
>         Attachments: image-2023-02-15-10-13-40-814.png
>
>
>  I noticed a memory leak occurs when the myfaces trace is specified.
> !image-2023-02-15-10-13-40-814.png|width=348,height=355!
> After the map is cleared (i.e view changes), I see a new contextual storage created during the debug logging, but never removed.
> {noformat}
> ContextualStorage.<init>(BeanManager,boolean) (org/apache/myfaces/cdi/util/ContextualStorage.java:58)
> ViewScopeContextualStorage.<init>(BeanManager) (org/apache/myfaces/cdi/view/ViewScopeContextualStorage.java:36)
> ViewScopeContextualStorageHolder.newContextualStorage(String) (org/apache/myfaces/cdi/view/ViewScopeContextualStorageHolder.java:59)
> ViewScopeContextualStorageHolder.newContextualStorage(String) (org/apache/myfaces/cdi/view/ViewScopeContextualStorageHolder.java:32)
> AbstractContextualStorageHolder.getContextualStorage(String,boolean) (org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java:111)
> AbstractContextualStorageHolder.getContextualStorage(String) (org/apache/myfaces/cdi/util/AbstractContextualStorageHolder.java:93)
> ViewScopeContextualStorageHolder$Proxy$_$$_WeldClientProxy.getContextualStorage(String) (Unknown Source:-1)
> ViewScopeCDIMap.getStorage() (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:60)
> ViewScopeCDIMap.getCreationalContextInstances() (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:67)
> ViewScopeCDIMap.entrySet() (org/apache/myfaces/cdi/view/ViewScopeCDIMap.java:181)
> ViewScopeProxyMap.entrySet() (org/apache/myfaces/view/ViewScopeProxyMap.java:169)
> AbstractMap.toString() (/java.base/java.util/AbstractMap.class:544)
> DebugUtils.printAttribute(PrintStream,String,Object) (org/apache/myfaces/util/DebugUtils.java:373)
> DebugUtils.printComponent(UIComponent,PrintStream,int,boolean,String) (org/apache/myfaces/util/DebugUtils.java:226)
> DebugUtils.printView(UIViewRoot,PrintStream) (org/apache/myfaces/util/DebugUtils.java:147)
> DebugUtils.traceView(String,UIViewRoot) (org/apache/myfaces/util/DebugUtils.java:139)
> DebugUtils.traceView(String) (org/apache/myfaces/util/DebugUtils.java:119)
> LifecycleImpl.render(FacesContext) (org/apache/myfaces/lifecycle/LifecycleImpl.java:266)
> FacesServlet.service(ServletRequest,ServletResponse) (/myfaces-api-4.0.0-RC5-SNAPSHOT.jar/jakarta.faces.webapp/FacesServlet.class:225)
> ServletWrapper.service(ServletRequest,ServletResponse,WebAppServletInvocationEvent) (Unknown Source:1260){noformat}
> This problem only occurs when the trace is specified. The DebugUtils tries to print out the ViewMap and a new storage is created during this process.
> Is seems like there are two ViewMap (ViewScopeCDIMap) used since the storage for the cleared view is marked as deactivated and this other one created a new storage object?
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)