[richfaces-issues] [JBoss JIRA] (RF-3878) Session memory leak

Patrick Decat (JIRA) jira-events at lists.jboss.org
Mon Oct 28 13:25:02 EDT 2013


    [ https://issues.jboss.org/browse/RF-3878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12825330#comment-12825330 ] 

Patrick Decat commented on RF-3878:
-----------------------------------

Reading the RichFaces 3.3 source code, I noticed it adds 1 to both numberOfLogicalViews and numberOfViewsInSession parameters:
{code:title=https://source.jboss.org/browse/RichFaces/tags/3.3.4.Final/framework/impl/src/main/java-jsf12/org/ajax4jsf/application/AjaxStateHolder.java?hb=true#to86}
 86                                         instance = new AjaxStateHolder(numbersOfViewsInSession,
 87                                                         numbersOfLogicalViews);
{code}
and:
{code:title=https://source.jboss.org/browse/RichFaces/tags/3.3.4.Final/framework/impl/src/main/java-jsf12/org/ajax4jsf/application/AjaxStateHolder.java?hb=true#to53}
 52         private AjaxStateHolder(int capacity, int numberOfViews) {
 53                 views = new LRUMap<String, LRUMap<String, StateReference>>(capacity+1);
 54                 this.numberOfViews = numberOfViews;
 55         }
{code}
and:
{code:title=https://source.jboss.org/browse/RichFaces/tags/3.3.4.Final/framework/impl/src/main/java-jsf12/org/ajax4jsf/application/AjaxStateHolder.java?hb=true#to173}
171                                         // TODO - make size parameter configurable
172                                         viewVersions = new LRUMap<String, StateReference>(
173                                                         this.numberOfViews+1);
174                                         views.put(viewId, viewVersions);
{code}

Therefore, I went one step further down and set both values to zero, effectively reaching a single view state:
{code}
  <context-param>
    <param-name>com.sun.faces.numberOfLogicalViews</param-name>
    <param-value>0</param-value>
  </context-param>
  <context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>0</param-value>
  </context-param>
{code}


That definitively breaks the back button support, but it saves lots of megabytes for us, dividing by 4 the peak per session memory usage...
                
> Session memory leak
> -------------------
>
>                 Key: RF-3878
>                 URL: https://issues.jboss.org/browse/RF-3878
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 3.2.0.SR1
>            Reporter: Dmitri Voronov
>            Assignee: Nick Belaevski
>             Fix For: 3.3.0
>
>
> AjaxStateHolder saves all views in the session. But the same view can occur several times in this "cache"; the views from this "cache" are not reused and just fill the session. If an application has many large views and deals with many concurrent sessions, the heap can easily grow up to Gigabytes(!)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the richfaces-issues mailing list