You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/04/20 17:44:19 UTC

DO NOT REPLY [Bug 53081] WebappClassLoader causes java.lang.OutOfMemoryError in findResourceInternal()

https://issues.apache.org/bugzilla/show_bug.cgi?id=53081

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> 2012-04-20 15:44:19 UTC ---
Stack trace is:

java.lang.OutOfMemoryError: Java heap space
    at
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:3098)
    at
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:1244)
    at
org.apache.catalina.loader.WebappClassLoader.getResource(WebappClassLoader.java:1407)
    at
org.springframework.core.io.ClassPathResource.exists(ClassPathResource.java:139)
    at
org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:248)
    at
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:134)
    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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy30.open(Unknown Source)
    at
org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:93)
    at
org.springframework.batch.core.step.item.ChunkMonitor.open(ChunkMonitor.java:105)
    at
org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:93)
    at
org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:301)
    at
org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:192)
    at
org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
    at
org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    at
org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    at
org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    at
org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    at
org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
    at
org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
    at
org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) 
Line of code in 7.0.x/trunk and trunk is actually 3151:

  byte[] binaryContent = new byte[contentLength];

I would argue that instead of only loading certain types of resources (using
what? magic number or other content-type-sniffing?), WebAppClassLoader could be
configured never to load complete content for resources over a certain size.

I'd be interested to hear why resources are loaded in their entirety in this
way. Another flavor of findResourceInternal(File,String) only creates URI
objects and does not access the disk at all.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org