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

           Summary: DeployTask throws OutOfMemoryErrors when deploying
                    large WAR files
           Product: Tomcat 6
           Version: 6.0.24
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Manager application
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=24967)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24967)
patch (diffed from org/apache/catalina/ant)

I consistently get OutOfMemory errors when attempting to deploy a 70 mb WAR
file to Tomcat using the Deploy ant task:

java.lang.OutOfMemoryError: Java heap space
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:262)
        at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
        at com.flyer.izpack.webapp.Deploy.run(Deploy.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ExecutableClass.run(Unknown
Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ProcessingJob.run(Unknown
Source)
        at com.izforge.izpack.installer.ProcessPanelWorker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.io.ByteArrayOutputStream.write(Unknown Source)
        at sun.net.www.http.PosterOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:215)
        ... 10 more
--- Nested Exception ---
java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.io.ByteArrayOutputStream.write(Unknown Source)
        at sun.net.www.http.PosterOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:215)
        at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
        at com.flyer.izpack.webapp.Deploy.run(Deploy.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ExecutableClass.run(Unknown
Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ProcessingJob.run(Unknown
Source)
        at com.izforge.izpack.installer.ProcessPanelWorker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

I've tracked the issue to the use of java.net.HttpURLConnection without setting
the contentLength (in some cases) and not using 'fixed length streaming mode'
when contentLength is available.

I'm attaching a patch that works for me with the DeployTask. I know that
org.apache.catalina.ant.AbstractCatalinaTask is subclassed by many tasks, but I
haven't tested all of those.

I can probably provide some code to reproduce if needed.

See also: https://issues.apache.org/bugzilla/show_bug.cgi?id=47660

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to