cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: [#COCOON-2168] ResourceReader produces Java Heap Overflow when reading a huge resource - ASF JIRA
Date Tue, 11 Mar 2008 09:10:48 GMT
Carsten Ziegeler schrieb:
> Joerg Heinicke wrote:
>> On 05.03.2008 23:06, Joerg Heinicke wrote:
>>
>>> We could argue about another default value than -1 though. Something 
>>> like 1024^2.
>>
>> What do others think? Shall we change the default value from "buffer 
>> everything" (which lead to the OutOfMemoryError [1]) to something 
>> more "secure" in the sense of avoiding a potential source of error? 
>> Besides mentioning it on the changes page we have to set it to a 
>> value that's unlikely to be hit with a normal web application to 
>> change user application's behavior only in extreme cases. That's why 
>> I suggested 1MB.
>>
> Hmm, not sure if we should change the default value. The idea of this 
> default was to be sure that error handling works out of the box. If 
> you have special cases like mentioned in the bug, it makes imho more 
> sense to fine tune these special cases (for instance by not buffering).
>
> The output buffer value is one of the settings which is "optimized" 
> for development and it should be tweaked for production usage. I think 
> also if you're using a reader in your pipeline it is more likely that 
> you don't want to let the pipeline buffer your output.

IIUC this should work (no caching pipeline, set buffer-size to 8192):

    <map:pipeline id="test-nocache" type="noncaching">
      <map:match pattern="nocache">
        <map:read src="/home/felix/tmp/livecd-i686-installer-2007.0.iso" >
          <map:parameter name="buffer-size" value="8192" />
        </map:read>
      </map:match>
    </map:pipeline>

but it doesn't

java.lang.OutOfMemoryError: Java heap space
        at 
org.apache.cocoon.util.BufferedOutputStream.incBuffer(BufferedOutputStream.java:148)
        at 
org.apache.cocoon.util.BufferedOutputStream.write(BufferedOutputStream.java:96)
        at 
org.apache.cocoon.reading.ResourceReader.processStream(ResourceReader.java:355)
        at 
org.apache.cocoon.reading.ResourceReader.generate(ResourceReader.java:386)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processReader(AbstractProcessingPipeline.java:656)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:431)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:72)
        at $Proxy8.process(Unknown Source)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.ReadNode.invoke(ReadNode.java:94)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:78)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:144)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:78)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:81)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:171)
        at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:247)
        at 
org.apache.cocoon.servlet.RequestProcessor.process(RequestProcessor.java:351)
        at 
org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java:169)
        at 
org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:84)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:501)
        at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:473)
        at 
org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:230)
        at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy5.service(Unknown Source)


Felix

>
> Carsten
>
>> Joerg
>>
>> [1] https://issues.apache.org/jira/browse/COCOON-2168
>>
>
>


Mime
View raw message