Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4563

ViewScope Memory Leak When Trace Enabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-RC4
    • 4.0.0
    • None
    • None

    Description

       I noticed a memory leak occurs when the myfaces trace is specified.

      After the map is cleared (i.e view changes), I see a new contextual storage created during the debug logging, but never removed.

      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)

      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?

       

       

      Attachments

        1. image-2023-02-15-10-13-40-814.png
          456 kB
          Volodymyr Siedlecki

        Issue Links

          Activity

            People

              volosied Volodymyr Siedlecki
              volosied Volodymyr Siedlecki
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: