Stripes

Layout tags don't handle huge inserted contents (layout definitions) well, usage results in OutOfMemory errors

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: Release 1.4.3
  • Fix Version/s: Release 1.5.4
  • Component/s: Tag Library
  • Labels:
    None

Description

I'm using the Stripes layout tag library and am experiencing difficulties rendering huge web pages.
An example structure is the following (/WEB-INF/jsp/content.jsp file generates approximately 13 megabytes of data)

<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="stripes" %>
<stripes:layout-render name="/WEB-INF/jsp/layout.jsp">
<stripes:layout-component name="body-content">
<!-- either this -->
<stripes:layout-render name="/WEB-INF/jsp/content.jsp"/>
<!-- or this -->
<jsp:include page="/WEB-INF/jsp/content.jsp" flush="true"/>
</stripes:layout-component>
</stripes:layout-render>

This results in OutOfMemory errors being thrown (and page not being displayed), the server has 512MB of heap space available.

Changing the code in LayoutRenderTag.java from

BodyContent content = getPageContext().pushBody();
getPageContext().include(this.name, false);
getPageContext().popBody();
getPageContext().getOut().write(content.getString());

to

getPageContext().include(this.name, false);

I am able to render the large jsp files inside the layout-render tags.

Could this somehow be fixed ? Could you consider adding an additional attribute to the layout-render tag that would work without loading the whole contents of the inserted subpage into a buffer ?

Issue Links

Activity

Hide
Karel Kolman added a comment - 21/Jan/08 5:45 AM

The code change I had posted above is probably rubbish and doesn't help much (if at all).

Still it would be cool to have the opportunity to use layouts with large subcomponents.The Tiles 2 project is better at doing this, the putAttribute http://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/putAttribute.html tag, which is meant to assign content to be rendered to a template/layout, accepts nested content like <stripes:layout-component> tag does but can also render another template/jsp like this
<tiles:putAttribute name="body-content" type="template" value="template.jsp"/>
which happens to be less memory hungry.

Show
Karel Kolman added a comment - 21/Jan/08 5:45 AM The code change I had posted above is probably rubbish and doesn't help much (if at all). Still it would be cool to have the opportunity to use layouts with large subcomponents.The Tiles 2 project is better at doing this, the putAttribute http://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/putAttribute.html tag, which is meant to assign content to be rendered to a template/layout, accepts nested content like <stripes:layout-component> tag does but can also render another template/jsp like this <tiles:putAttribute name="body-content" type="template" value="template.jsp"/> which happens to be less memory hungry.
Hide
Ben Gunter added a comment - 13/May/10 11:24 AM

Revisions 1228 and 1229 (on the 1.5.x branch) change the tags from buffering to streaming. Please test these changes and let me know how they work for you.

Show
Ben Gunter added a comment - 13/May/10 11:24 AM Revisions 1228 and 1229 (on the 1.5.x branch) change the tags from buffering to streaming. Please test these changes and let me know how they work for you.
Hide
Karel Kolman added a comment - 19/May/10 3:09 PM

i'm sorry, i have not been working on the project for a long time now and since i had not posted nor created a suitable test case for the issue i can't test the fix.

Show
Karel Kolman added a comment - 19/May/10 3:09 PM i'm sorry, i have not been working on the project for a long time now and since i had not posted nor created a suitable test case for the issue i can't test the fix.
Hide
Ben Gunter added a comment - 30/Sep/10 11:58 AM

Fixed for 1.5.4.

Show
Ben Gunter added a comment - 30/Sep/10 11:58 AM Fixed for 1.5.4.

People

Vote (0)
Watch (1)

Dates

  • Created:
    20/Jun/07 4:22 AM
    Updated:
    04/Jan/11 2:48 PM
    Resolved:
    30/Sep/10 11:58 AM