myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3739) @ResourceDependency annotation + JSF 1.2 state saving + c:if (dynamic section) creates components on each click (UIViewRoot grows)
Date Mon, 24 Jun 2013 00:11:20 GMT


Leonardo Uribe commented on MYFACES-3739:

I have changed the title of the issue to be more descriptive about the necessary conditions
to make it happen. More than a memory leak is a state saving leak that under some conditions
could cause a memory leak.

This is a known defect of the design done for @ResourceDependency annotation and JSF 1.2 state
saving. With partial state saving, all components of the tree are recreated using Application.createComponent(),
so the components added using @ResourceDependency annotations are added too. Since those components
are recreated each time the view is build, there is no need to save them on the state. 

But things are different for JSF 1.2 state saving. In this case all instances are saved with
the state. There missing part is something that recalculate that part at each request, but
the current spec as is does not consider that.

Any solution that try to keep track of the relationship between the @ResourceDependency and
the component / renderer that originates it just increase the state size too. The consideration
is since the state does not grow fast enough it is more optimal to keep things simple and
let it as is, than try a more complex solution that will put a "constant big weight" over
the state.

Even so, a solution is feasible, but it will not be easy, because we need in this part an
algorithm with linear complexity, otherwise the performance will be affected, at least with
JSF 1.2 state saving. Note the conditions to reproduce the problem are very rare.

One option that comes to my mind is with JSF 1.2 state saving scan UIViewRoot facets and fill
RequestViewContext properly, to ensure the dynamic part takes into account the previous added
references, and it that way, there will not be duplicates. I need to think about that carefully,
but at first view it could work.
> @ResourceDependency annotation + JSF 1.2 state saving + c:if (dynamic section) creates
components on each click (UIViewRoot grows)
> ----------------------------------------------------------------------------------------------------------------------------------
>                 Key: MYFACES-3739
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.1.12
>         Environment: myfaces 2.1.12
> Tomcat 6.0.36
>            Reporter: Andrei Zhemaituk
> The issue was initially reported against RichFaces:
> But it does not look like it is anything wrong with RichFaces here.
> The issue is reproducible with pure myfaces when partial state saving is turned OFF e.g.
with the following code (every second click on "Toggle" button causes new UIOutput element
to be inserted to the view tree):
> {code}
>   <h:form>
>     <h:commandButton value="Toggle" action="#{bean.togglePanelShown}">
>       <f:ajax execute="@this" render="group"/>
>     </h:commandButton>
>     <h:panelGroup id="group">
>       <c:if test="#{bean.panelShown}">
>         <!-- Any component with @ResourceDependency annotation. -->
>         <custom:componentWithResourceDependency/>
>       </c:if>
>     </h:panelGroup>
>   </h:form>
> {code}

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:

View raw message