You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2007/08/20 11:33:34 UTC

[jira] Updated: (STR-2976) NestedRootTag and NestedPropertyTag's doStartTag() could return EVAL_BODY_INCLUDE

     [ https://issues.apache.org/struts/browse/STR-2976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-2976:
-------------------------------

    Fix Version/s: 1.4.0

> NestedRootTag and NestedPropertyTag's doStartTag() could return EVAL_BODY_INCLUDE
> ---------------------------------------------------------------------------------
>
>                 Key: STR-2976
>                 URL: https://issues.apache.org/struts/browse/STR-2976
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Taglibs
>    Affects Versions: 1.3.5
>            Reporter: Hayden Foot
>             Fix For: 1.4.0
>
>
> The nested:nest (NestedRootTag) and nested:root (NestedRootTag) only set context and scope for other tags within its body, they do not output any content themselves or manipulate the content with in their body, and yet they return EVAL_BODY_TAG (equivalent to EVAL_BODY_BUFFERED) rather than EVAL_BODY_INCLUDE.  This means a new BodyContent object is created for the body rather than using the existing one (passed through to the current out).
> This can be an issue if the body of either a nested:nest or a nested:root tag generates a large amount of data because the BodyContent object of the tag's body will not flush to the underlying stream until the tag's body is complete.  When running under Tomcat the BodyContent implementation is org.apache.jasper.runtime.BodyContentImpl, and because these objects are pooled and their underlying buffers (char[]) will grow (but not shrink), when rendering large pages (i.e. large content inside nested:nest or nested:root tags)  the BodyContent object used for the tag's body can grow very large (because it can not flush) and will also be retained after the page has rendered (because the object is pooled - hence not released).
> I have experimented by extending the NestedPropertyTag and NestedRootTag classes and overriding the doStartTag() method in the following way:
>   public int doStartTag() throws JspException {
>     super.doStartTag();
>     return EVAL_BODY_INCLUDE;
>   }
> In a test case, using this implementation rather than returning EVAL_BODY_TAG, meant the body of the tag could stream/flush and hence did not need to grow the BodyContent buffer.  The result was that the retained memory (of BodyContentImpl) was significantly reduced (approx 35k as opposed to > 100M).
> I proposed that you change the implementation of both NestedRootTag and NestedPropertyTag's doStartTag() method to return EVAL_BODY_INCLUDE as there is no obvious reason why it needs to buffer the body.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.